Created
August 3, 2017 14:15
-
-
Save mootari/290774c9f21ee95f5923a754bf5b8d9e to your computer and use it in GitHub Desktop.
Drupal 7, Views: Alter field output in table display.
This file contains hidden or 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
<?php | |
/** | |
* Implements hook_preprocess_HOOK(). | |
* | |
* Marks projects that have a reference in content overview. | |
*/ | |
function MODULE_preprocess_views_view_field(&$vars) { | |
if(!empty($vars['view']->MODULE_foo) && $vars['field']->field_alias === 'node_type') { | |
if(!empty($vars['view']->MODULE_foo[$vars['row']->nid])) { | |
$suffix = ', <i>with SUFFIX</i>'; | |
$vars['output'] .= $suffix; | |
// Views tokens use the value from views_field_handler::$last_render. | |
$vars['field']->last_render .= $suffix; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment