You are here

function global_filter_options_none in Views Global Filter 8

Same name and namespace in other branches
  1. 7 global_filter.widgets.inc \global_filter_options_none()

Override of the theme_options_none() function.

In addition to the regular options as returned by hook_options_list, the Options module will always prepend a 'none' for non-required fields, whether appearing as a single or multiple-select. We can't intercept this process. We could make the select mandatory and then prepend a 'none' option ourselves, but then we end up with a red asterisk for a select that isn't really mandatory...

Until I can find a way to determine if this is a global filter context, I'll switch this feature off for global filters driven by field widgets.

1 string reference to 'global_filter_options_none'
global_filter_theme_registry_alter in ./global_filter.widgets.inc
Implements hook_theme_registry_alter().

File

./global_filter.widgets.inc, line 625
global_filter.widgets.inc

Code

function global_filter_options_none($variables) {
  if (!empty($variables['global_filter_context'])) {

    // See comment above.
    $filter_key = global_filter_key_by_name($variables['instance']['field_name']);
    $option_all_text = global_filter_get_parameter($filter_key, 'option_all_text');
    if (!empty($option_all_text)) {
      return $option_all_text == t('<none>') ? '' : check_plain($option_all_text);
    }
  }

  // Not used in a global filter context or no 'All' text specified, so return
  // the widget default.
  return theme_options_none($variables);
}