Created
April 8, 2014 09:22
-
-
Save samuelsolis/10103907 to your computer and use it in GitHub Desktop.
Preprocess field in Display Suite module, Drupal 7 example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Before this, you have to create a "Preproces field" with name like "mycustomfield". | |
* In this example we render an user image (a image field, not the user picture). | |
* | |
*/ | |
function MYMODULE_preprocess_comment(&$vars){ | |
$author= user_load($vars['user']->uid); | |
$settings= array('settings' => array('image_style' => 'thumbnail'),'label' => 'hidden' ); | |
$vars['mycustomfield'] = render(field_view_field('user', $author, 'field_user_main_image', $settings)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment