diff -u b/contrib/search_api_views/includes/handler_filter.inc b/contrib/search_api_views/includes/handler_filter.inc --- b/contrib/search_api_views/includes/handler_filter.inc +++ b/contrib/search_api_views/includes/handler_filter.inc @@ -32,22 +32,6 @@ public $query; /** - * Provide some extra help to get the operator/value easier to use. - */ - public function init(&$view, &$options) { - parent::init($view, $options); - - // Backward compatibility. - if (!is_array($this->value)) { - $this->value = array( - 'value' => $this->value, - 'min' => '', - 'max' => '', - ); - } - } - - /** * Redefine the value option to be able to deal with multiple values. */ public function option_definition() { @@ -59,6 +43,7 @@ 'value' => array('default' => ''), ), ); + return $options; } @@ -86,12 +71,11 @@ * * @see views_handler_filter_numeric::value_form() */ - function value_form(&$form, &$form_state) - { + function value_form(&$form, &$form_state) { $form['value']['#tree'] = TRUE; $single_field_operators = $this->operator_options(); - unset($single_field_operators['between']); + unset($single_field_operators['empty'], $single_field_operators['not empty'], $single_field_operators['between']); // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus @@ -107,7 +91,8 @@ if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // Exposed and locked. $which = ($this->operator == 'between') ? 'minmax' : 'value'; - } else { + } + else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } @@ -125,7 +110,8 @@ if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['value'])) { $form_state['input'][$identifier]['value'] = $this->value['value']; } - } elseif ($which == 'value') { + } + elseif ($which == 'value') { // When exposed we drop the value-value and just do value if // the operator is locked. $form['value'] = array( @@ -165,9 +151,9 @@ $form_state['input'][$identifier]['max'] = $this->value['max']; } - if (!isset($form['value'])) { + if (!isset($form['value']['value'])) { // Ensure there is something in the 'value'. - $form['value'] = array( + $form['value']['value'] = array( '#type' => 'value', '#value' => NULL, ); @@ -179,10 +165,6 @@ * Display the filter on the administrative summary */ function admin_summary() { - if ($this->operator === 'between') { - return 'is between ' . check_plain((string) $this->value['min']) . ' / ' . check_plain((string) $this->value['max']); - } - if (!empty($this->options['exposed'])) { return t('exposed'); } @@ -194,7 +176,11 @@ return t('is not empty'); } - return check_plain((string) $this->operator) . ' ' . check_plain((string) $this->value); + if ($this->operator === 'between') { + return 'is between ' . check_plain((string) $this->value['min']) . ' / ' . check_plain((string) $this->value['max']); + } + + return check_plain((string) $this->operator) . ' ' . check_plain((string) $this->value['value']); } /** only in patch2: unchanged: --- a/contrib/search_api_views/includes/handler_filter_options.inc +++ b/contrib/search_api_views/includes/handler_filter_options.inc @@ -121,6 +121,7 @@ class SearchApiViewsHandlerFilterOptions extends SearchApiViewsHandlerFilter { */ public function option_definition() { $options = parent::option_definition(); + $options['value'] = array('default' => ''); $options['expose']['contains']['reduce'] = array('default' => FALSE); return $options; }