I'm using Display Suite to show a referenced node inside another node in the default display. But when I edit this node that has the entity reference field on it, it shows me the reference field and I'd like that to show the rendered content of a field of the referenced node. Is there a way in Display Suite or do I have to write some code in a tpl file somewhere?
You can create using Views a view with "Entity Reference" where you can make the rendered content you wish to add to the node. Than add a new field of type "Entity Reference" to the node edit form of this node type and set up in section "Entity selection":
- Mode -> 'Views: Filter by an entity reference view"
- View used to select the entities -> choose the view machine name you have created for this purpose
Additionally, you can provide a comma separated list of arguments to pass to the view.
To avoid some status messages like 'Do something on load', you should uncheck "Test behavior" in "Additional behaviors" section.
Hope it helps
You can use Inline Entity Display module,
Make available the fields and text properties from referenced entities into the parent entity template and the manage fields display overview. Drupal standard entity display:
Node - title - field body - field reference -> default formatters With IED enabled:
Node - title - field body - field reference -> default formatters - field from field reference: field_name1 - field from field reference: field_name2 - properties of type text from field reference: propertyname1 -etc
and Also you can render it programmatically in
tpl file with something like
// $node = node_load($nid); if you in node $node exists by default $values = field_get_items('node', $node, 'yourfieldmachinename'); $output = field_view_value('node', $node, 'yourfieldmachinename', $values); print render($output);