Skip to content

Instantly share code, notes, and snippets.

@jeremycaldwell
Created November 15, 2016 16:13
Show Gist options
  • Select an option

  • Save jeremycaldwell/47b9ced3224acb349a821abb12980608 to your computer and use it in GitHub Desktop.

Select an option

Save jeremycaldwell/47b9ced3224acb349a821abb12980608 to your computer and use it in GitHub Desktop.
Print all values from array
$teaser_images = '';
$teaser_images = field_get_items('node', $node, 'field_teaser_image');
if (!empty($teaser_images)) {
foreach ($teaser_images as $teaser_image) {
$path = $teaser_image['uri'];
$alt = $teaser_image['alt'];
$title = $teaser_image['title'];
$nodeURL = 'node/' . $node->nid;
$image = theme_image_style(
array(
'style_name' => 'none',
'path' => $path,
'alt' => $alt,
'title' => $title,
'attributes' => array ('class' => 'fullimg'),
'width' => NULL,
'height' => NULL,
)
);
print l($image, $nodeURL, array('html' => TRUE, 'attributes' => array('class' => 'special-offer-anchor')));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment