views_handler_filter_equality.inc

Same filename in other branches
  1. 6.x-3.x handlers/views_handler_filter_equality.inc

Definition of views_handler_filter_equality.

File

handlers/views_handler_filter_equality.inc

View source
<?php


/**
 * @file
 * Definition of views_handler_filter_equality.
 */

/**
 * Simple filter to handle equal to / not equal to filters.
 *
 * @ingroup views_filter_handlers
 */
class views_handler_filter_equality extends views_handler_filter {
    
    /**
     * Exposed filter options.
     */
    public $always_multiple = TRUE;
    
    /**
     * Provide simple equality operator.
     */
    public function operator_options() {
        return array(
            '=' => t('Is equal to'),
            '!=' => t('Is not equal to'),
        );
    }
    
    /**
     * Provide a simple textfield for equality.
     */
    public function value_form(&$form, &$form_state) {
        $form['value'] = array(
            '#type' => 'textfield',
            '#title' => t('Value'),
            '#size' => 30,
            '#default_value' => $this->value,
        );
        if (!empty($form_state['exposed'])) {
            $identifier = $this->options['expose']['identifier'];
            if (!isset($form_state['input'][$identifier])) {
                $form_state['input'][$identifier] = $this->value;
            }
        }
    }

}

Classes

Title Deprecated Summary
views_handler_filter_equality Simple filter to handle equal to / not equal to filters.