function views_handler_filter_combine::options_form

Overrides views_handler_filter::options_form

File

handlers/views_handler_filter_combine.inc, line 33

Class

views_handler_filter_combine
Filter handler which allows to search on multiple fields.

Code

public function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $this->view
        ->init_style();
    // Allow to choose all fields as possible.
    if ($this->view->style_plugin
        ->uses_fields()) {
        $options = array();
        foreach ($this->view->display_handler
            ->get_handlers('field') as $name => $field) {
            $options[$name] = $field->ui_name(TRUE);
        }
        if ($options) {
            $form['fields'] = array(
                '#type' => 'select',
                '#title' => t('Choose fields to combine for filtering'),
                '#description' => t("This filter doesn't work for very special field handlers."),
                '#multiple' => TRUE,
                '#options' => $options,
                '#default_value' => $this->options['fields'],
            );
        }
        else {
            form_set_error('', t('You have to add some fields to be able to use this filter.'));
        }
    }
}