function global_filter_form_views_ui_config_item_form_alter in Views Global Filter 8
Same name and namespace in other branches
- 7 global_filter.module \global_filter_form_views_ui_config_item_form_alter()
Implements hook_form_FORMID_alter().
Removes the Global Filter for proximity from the form where not applicable.
File
- ./
global_filter.module, line 243 - global_filter.module
Code
function global_filter_form_views_ui_config_item_form_alter(&$form, &$form_state) {
if ($form_state['handler']->handler_type == 'argument') {
$definition = $form_state['handler']->definition;
if ($definition['handler'] == 'location_handler_argument_location_proximity') {
// Location module proximity contextual filter: keep Global Filter
// Proximity.
return;
}
// Use if ($definition['handler'] == 'geofield_handler_argument_proximity')?
if (isset($definition['field_name']) && ($field = field_info_field($definition['field_name'])) && $field['type'] == 'geofield') {
// Geofield module proximity contextual filter. Keep Global Filter
// Proximity.
return;
}
// For all other modules the filter is not defined/supported.
unset($form['options']['default_argument_type']['#options']['global_filter_proximity']);
}
}