function FilterPluginBase::prepare_filter_select_options

Sanitizes the HTML select element's options.

The function is recursive to support optgroups.

1 call to FilterPluginBase::prepare_filter_select_options()
FilterPluginBase::exposed_translate in drupal/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
Make some translations to a form item to make it more suitable to exposing.

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php, line 1108
Definition of Drupal\views\Plugin\views\filter\FilterPluginBase.

Class

FilterPluginBase
Base class for filters.

Namespace

Drupal\views\Plugin\views\filter

Code

function prepare_filter_select_options(&$options) {
  foreach ($options as $value => $label) {

    // Recurse for optgroups.
    if (is_array($label)) {
      $this
        ->prepare_filter_select_options($options[$value]);
    }
    elseif (is_object($label)) {
      $this
        ->prepare_filter_select_options($options[$value]->option);
    }
    else {
      $options[$value] = strip_tags(decode_entities($label));
    }
  }
}