0

I need to add a link to a file, added through a file field on its own content type called "Document" from another content type and node call "plan information".

The idea is that the "document" nodes are displayed to provide access to a collection of "documents" throughout the entire site. This content type simply has a title and a file field. That cannot change.

What I need to do is to add a LINK to a user-selected document on the "plan information" content type that links the "document" to the appropriate "plan information" node as selected by the content manager.

On the "plan information" nodes, I want to simply create a UL of the document(s) attached using the title of the "document" node as the anchor text.

We've had a big problem with updating documents where associating the right "document" link on the correct "plan information" node has been problematic at best.

I've tried entity reference but couldn't get that to work. It would either bring in the entire document node, or nothing at all.

I tried node reference but it wants to behave in a similar way as the entity reference did, pulling in the whole node.

I tried field reference, but again, no success.

Most grateful for any guidance/insight on this.

  • Are you having issues "outputting" the referenced entities the way you want IIUC? It's a bit tough to understand what exactly is your problem. Have you tried using "Manage Display" of those entities and trying out different ways to render? You can also use Views – Beebee Aug 28 at 11:38
1

Ok - I got it figured out.

All I needed was the entity reference field.

I then followed the steps in the article posted below which allowed me to then be able to attach my document entities to my plan info nodes.

https://www.ostraining.com/blog/drupal/entity-reference-view/

Then i was able to create a view of the plan info nodes by creating a relationship in views to the referenced entity on the nodes, then I had the necessary fields available to me as fields for my view, and that solved everything.

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.