Skip to content

Instantly share code, notes, and snippets.

@mynameispj
Last active December 19, 2015 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mynameispj/5991363 to your computer and use it in GitHub Desktop.
Save mynameispj/5991363 to your computer and use it in GitHub Desktop.
Drupal 7 Field Collections - Loop to avoid cruft markup
<?php
$front_page = node_load("1");
foreach ($front_page->field_slideshow_images['und'] as $key => $value) {
$slide = entity_load('field_collection_item', array($value['value']));
$idx = $value['value'];
?>
<div class="rsContent slide">
<img src="<?php print image_style_url('none', $slide[$idx]->field_image['und']['0']['uri']); ?>" class="rsImg">
<div class="projectInfo">
<p><?php print $slide[$idx]->field_title_of_project['und']['0']['value']; ?></p>
<p><?php print $slide[$idx]->field_place['und']['0']['value']; ?></p>
</div>
</div>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment