Drupal 7 : display entity reference with multiple values

<?php $fielditems = field_get_items('node', $node, 'field_event_entity');?> <?php foreach($fielditems as $individualitem): ?> <?php { $title = $individualitem['entity']->title; $summary = $individualitem['entity']->field_event_summary['und'][0]['value']; }?> <div><?php echo($title);?></div> <div><?php echo($summary);?></div> <?php endforeach; ?>
This lets you use the Drupal7 entity reference with multiple values to pull out individual fields and echo them in a foreach.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.