Created
March 29, 2010 17:49
-
-
Save bangpound/348166 to your computer and use it in GitHub Desktop.
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 | |
// This theme prepreocess function brands node types in specific views | |
// with the site name. | |
function alshabaka_policybriefs_preprocess_views_view_field(&$vars, $hook) { | |
// Use a switch statement because I may need to alter other fields too. | |
switch ($hook) { | |
case 'views_view_field__alshabaka_frontpage__type': | |
case 'views_view_field__alshabaka_frontpage_bottom__type': | |
// I know this t() function call is utter nonsense. | |
$value = t('@site @type', array( | |
'@site' => variable_get('site_name', 'Drupal'), | |
'@type' => $vars['field']->original_value, | |
)); | |
if ($hook == 'views_view_field__alshabaka_frontpage__type') { | |
// In this view, the field is excluded and used in the altered output of | |
// another field later in the list. | |
$vars['field']->last_render = $value; | |
} | |
else { | |
// In other views, the field is not excluded and is rendered through its | |
// own regular theme functions. | |
$vars['output'] = $value; | |
} | |
break; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment