Posted by byenary on November 21, 2012 at 7:16pm
Hi there,
I'd like to show/not show fields in a view depening on a condition (language)
I've found out I need to use the hook :
hook_views_pre_view
But can't find out how to show/hide fields using the hook.
Thx in advance!
Comments
Use a template suggestion and
Use a views template suggestion and then hide unnacessary fields in it.
Senior developer & consultant
Drupal developer / module builder for more thant 5 years
That could be a solution
That could be a solution indeed, maybe its just easy'r then to create a sperate view for each language
/** * Implements
for Views 3:
/*** Implements hook_views_pre_render().
*/
function MODULENAME_views_pre_render(&$view) {
if ($view->name == 'VIEW_NAME' && $view->current_display == 'DISPLAY_NAME' && OTHER_CONDITIONS) {
$view->field['FIELD_NAME']->options['exclude'] = TRUE;
}
}
Subscribed
Subscribed