Skip to content

Instantly share code, notes, and snippets.

@anthonyringoet
Created May 10, 2012 09:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonyringoet/2652057 to your computer and use it in GitHub Desktop.
Save anthonyringoet/2652057 to your computer and use it in GitHub Desktop.
Display Suite field to link one field over another
<?php
$url = $entity->field_name_link['und']['0']['url'];
$imgField = $entity->field_name_image['und']['0'];
$config = array(
'style_name' => 'i_am_the_name_of_your_image_style',
'path' => $imgField['uri'],
'title' => $imgField['alt'],
'alt' => $imgField['title'],
'width' => $imgField['width'],
'height' => $imgField['height']
);
$image = theme_image_style($config);
print l($image, $url, array('html' => true, 'attributes' => array('class' => 'external')));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment