2

I want to add a field to a custom content type that allows users to select other content from the site to display as a list on the given node.

I can do this by creating an entity reference field to content type. This works, but I can only seem to have it show the link in reference to the Title field of the corresponding node. I want to set a different field as the link. How do I do this?

If I could show the fields in a view, I could select the field to show more easily, however, I have not found a way to have a view show the contents of a field from the current page.

Originally, I had implemented this via a system of taxonomy terms and a view but my users want the ability to go in and manually set the relationships so I have had to fall back to this. If someone has a better suggestion for this problem I would love to hear it.

3
  • you want to show the content field than title to user while selecting? Did you tried Entity Reference Views Select module, if it works?
    – Yogesh
    Sep 22, 2016 at 4:49
  • Ideally the user would still select based on the title. We just have a custom 'teaser-heading' field for display in lists and menus etc. Actually, really ideally the user would be able to choose for each item which is displayed.
    – tanbog
    Sep 22, 2016 at 4:54
  • I found this tutorial helpful: chapterthree.com/blog/… Dec 27, 2018 at 0:15

2 Answers 2

2

I've done this before:

You can override the Autocomplete field widget, so instead of title, it will give you back something else! You need to inheritance the existing one and after 2-3 of other inheritance you will be able to reach the autocomplete ajax functionality and rewrite it. It's pretty complex, but not impossible!

4
  • This approach makes me curious, any suggestions where I can read more about doing this? I have worked around the issue for now by creating a view but would prefer to have control over the fields themselves.
    – tanbog
    Sep 23, 2016 at 12:43
  • Sure! I will get you the answer when I get back to the office on monday!
    – ssibal
    Sep 24, 2016 at 13:09
  • Could you share that with me too? Dec 20, 2018 at 23:56
  • I was able to do what I needed. I found this tutorial helpful: chapterthree.com/blog/… Dec 27, 2018 at 0:11
-1

I think this is the module you are looking for: https://www.drupal.org/project/inline_entity_form

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.