You are here

public function views_handler_filter_combine::options_form in Views (for Drupal 7) 7.3

Provide the basic form which calls through to subforms.

If overridden, it is best to call through to the parent, or to at least make sure all of the functions in this form are called.

Overrides views_handler_filter::options_form

File

handlers/views_handler_filter_combine.inc, line 33
Definition of views_handler_filter_combine.

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.'));
    }
  }
}