1

I had an issue before (please click here to see it) related to entity reference and I was able to solve it with no problem. Now I have another issue:

I have 2 content types called projects and partners.

In the content type partners I have a field "projects" and I'm able to select from all the project pages that exist in my site. So far so great.

Now, in the content type projects I have a field "partners" and I would like this field to be autocompleted with the partners where that project was selected before.

What's the best way to do this?

Please let me know if you need any clarification, I know my English isn't the best.

Thanks so much in advance!

1 Answer 1

1

You can do this in various ways.

An easy option would be to display a view as the field. There are quite a few solutions that enable you to do so, such as:

Viewfield,

Viewfield provides a field that holds a reference to a View and renders it whenever the entity containing the field is displayed.

Field Embed Views,

The module provides a field type to attach any Views View display with, configurable on per-entity level, default values for exposed filters and sorting.

EVA,

"Eva" is short for "Entity Views Attachment;" it provides a Views display plugin that allows the output of a View to be attached to the content of any Drupal entity.

Panels, Display Suite, etc.

The view will list partners and the contextual filter will be the current project you are looking at.

If your field is also an entity reference field, then you should probably look at Corresponding Entity References.

Think about your solution where you will be duplicating database storage (both ends of a relationship) when one end can easily be computed (via an sql query for instance). Maintaining the data on both ends means more work as you have to synchronize it constantly, as well as more storage. Maintaining the data on one end only and making the other end purely a display issue is more maintainable.

1
  • Viewfield module solved my problem. With the help of this tutorial drupal.org/node/1210142 I managed to accomplish what I was looking for. Thank you!
    – Drii7
    Commented Jan 5, 2015 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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