Skip to content

Instantly share code, notes, and snippets.

@aliciaduffy
Created July 9, 2013 23:08
Show Gist options
  • Save aliciaduffy/5962141 to your computer and use it in GitHub Desktop.
Save aliciaduffy/5962141 to your computer and use it in GitHub Desktop.
For hiding/showing fields based on exposed filter setting.
function MYMODULE_views_views_post_build(&$view) {
if ($view->name == 'views_name') {
if (isset($view->exposed_input['field_geofield_distance'])) {
if (isset($view->field['field_geofield_distance'])) {
$view->field['field_geofield_distance']->options['exclude'] = TRUE;
}
} else {
if (isset($view->field['field_geofield_distance_1'])) {
$view->field['field_geofield_distance_1']->options['exclude'] = TRUE;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment