Skip to content

Instantly share code, notes, and snippets.

@drfeld
Last active June 30, 2016 05:01
Show Gist options
  • Save drfeld/67e478a3e88fd9a9b612 to your computer and use it in GitHub Desktop.
Save drfeld/67e478a3e88fd9a9b612 to your computer and use it in GitHub Desktop.
Drupal: Render a picture mapping programmatically
<?php
$picture = field_view_field('node', $node, '[IMAGE FIELD MACHINE NAME GOES HERE]', array(
'label' => 'hidden',
'type' => 'picture',
'settings' => array(
'picture_group' => '[PICTURE MAPPING MACHINE NAME GOES HERE]',
'fallback_image_style' => '[IMAGE STYLE MACHINE NAME GOES HERE]',
'image_link' =>'')));
print "<a href='/" . drupal_get_path_alias("node/" . $node->nid) . "'>" . render($picture) . "</a>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment