Is there a way to print Entity Reference field in node.tpl.php file?
I'll explain on a simple example. Let's say I have two content types: CMS and Version. I have created CMS node Drupal and Version nodes D6, D7 and D8:
CMS content type: Drupal
Version content type: D6, D7, D8
All of the Version nodes have Entity Reference field with value Drupal.
D6 -> Entity Reference field value: Drupal
D7 -> Entity Reference field value: Drupal
D8 -> Entity Reference field value: Drupal
Now I need to use node--version.tpl.php to output a simple link to node 'Drupal'. I have found various questions on this topic across the web, but surprisingly not a definitive and simple solution. Usual way of printing fields doesn't work:
<?php print $node->field_entityreferencefield['und'][0]['value']; ?>
Is this possible at all?
Comments
Comment #1
lindaweb CreditAttribution: lindaweb commentedNeed help on this any answers ??