You are here

function domain_entity_views_handler_filter_domain_domain_id::value_form in Domain Access Entity 7

Override views_handler_filter_in_operator::value_form().

Overrides views_handler_filter_in_operator::value_form

See also

views_handler_filter_in_operator::value_form()

File

includes/domain_entity_views_handler_filter_domain_domain_id.inc, line 49
Interface between domain_entity.module, domain_views.module and views.module.

Class

domain_entity_views_handler_filter_domain_domain_id
Filter for domain ids stored in the database.

Code

function value_form(&$form, &$form_state) {
  parent::value_form($form, $form_state);
  if (isset($form_state['input'][$this->real_field]) && $form_state['input'][$this->real_field] != NULL) {
    $current_domain = domain_get_domain();
    $accessible_domain_ids = domain_entity_get_user_available_domains();
    $domains = domain_domains();
    $possible_options = array_keys($this->value_options);

    // Check if the input is allowed.
    $value = $form_state['input'][$this->real_field];
    if (is_array($value)) {
      $value = reset($value);
    }
    if (!in_array($value, $possible_options)) {
      $form_state['input'][$this->real_field] = NULL;
    }
  }
}