You are here

function views_handler_filter_countries_list::get_value_options in Countries 7.2

Same name and namespace in other branches
  1. 8 views/views_handler_filter_countries_list.inc \views_handler_filter_countries_list::get_value_options()

Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.

This can use a guard to be used to reduce database hits as much as possible.

Return value

Return the stored values in $this->value_options if someone expects it.

Overrides views_handler_filter_in_operator::get_value_options

File

views/views_handler_filter_countries_list.inc, line 83
Views module filter handler class.

Class

views_handler_filter_countries_list
Filter by ISO Code 2.

Code

function get_value_options() {
  $options = array();
  switch ($this->options['configuration']) {
    case COUNTRIES_VIEWS_WIDGET_FIELD:
      if (isset($this->options['relationship'])) {
        if ($field = field_info_field(substr($this->options['relationship'], 0, -5))) {
          $options = $field['settings'];
        }
      }
      break;
    case COUNTRIES_VIEWS_WIDGET_CUSTOM:
      $options = $this->options['filter'];
      break;
  }
  $property = isset($this->definition['property']) ? $this->definition['property'] : 'name';
  $this->value_options = countries_filter(countries_get_countries($property), $options);
  uasort($this->value_options, 'countries_sort');
}