1

I would like to create a content type that has some unique fields but its other fields are references to other existing nodes (not a parent-child relationship but many to many relationship).

I have looked in entity reference module or field collection? Is there another way of doing this?

For example I have a synthesis report made up of smaller topics. I want this report to have a name and author but then it needs to reference multiple of these smaller topics (which are a content type of their own).

I could maybe make a Taxonomy term for every synthesis report?

3

The simplest way is to use the Entity Reference module. You can add fields to your content type which are a reference to other entities, like taxonomy terms, nodes, etc.

Note: You can combine it with field collection, but you need to understand that a field collection is not the same thing. A field collection lets you group fields so you can re-used them. For instance if you have multiple addresses, you can create a field collection with street, zipcode, city, etc. But in itself, it's not an entity. Entity reference lets you point from one entity to another.

  • but I need a grouping and I don't know how many references there are. Can I combine it with field collection? – arisalexis Aug 16 '16 at 11:25
  • Yes you can, but you need to understand that a field collection is not the same thing. A field collection lets you group fields so you can re-used them. For instance if you have multiple addresses, you can create a field collection with street, zipcode, city, etc. But in itself, it's not an entity. Entity reference lets you point from one entity to another. – Web-Beest Aug 16 '16 at 11:30
  • 1
    @Web-Beest : please verify my edit of your answer (I mostly just integrated your comment in it). If needed, further edit your answer, or simply perform a rollback to the prior revision if you don't like my edit at all. Doei! – Pierre.Vriens Aug 17 '16 at 10:00
3

You can use both References and Entity Reference module, then you can add a Reference field (Node Reference if using References module) or Entity Reference (in case of using Entity Reference module) , and then set the number of values for that field to 'Unlimited' (if you don't know how many references is needed for each report exactly).

Heading

PS. Entity References is more complicated to work with but it presents much better features in comparison by References Module.

  • If you need multiple value to be set for a certain field you don't need a field collection, the only option to change is to set the field number of values to unlimited. – Alireza Tabatabaeian Aug 16 '16 at 12:20
  • ok I missed that! I voted for the answer the first one just because of timing, sorry – arisalexis Aug 16 '16 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.