You are here

function views_handler_filter::expose_form_left in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 handlers/views_handler_filter.inc \views_handler_filter::expose_form_left()

Handle the 'left' side fo the exposed options form.

Overrides views_handler::expose_form_left

File

handlers/views_handler_filter.inc, line 233

Class

views_handler_filter
Base class for filters.

Code

function expose_form_left(&$form, &$form_state) {
  if (!empty($form['operator']['#type'])) {
    $form['expose']['use_operator'] = array(
      '#type' => 'checkbox',
      '#title' => t('Unlock operator'),
      '#description' => t('When checked, the operator will be exposed to the user'),
      '#default_value' => !empty($this->options['expose']['use_operator']),
    );
    $form['expose']['operator'] = array(
      '#type' => 'textfield',
      '#default_value' => $this->options['expose']['operator'],
      '#title' => t('Operator identifier'),
      '#size' => 40,
      '#description' => t('This will appear in the URL after the ? to identify this operator.'),
      '#process' => array(
        'views_process_dependency',
      ),
      '#dependency' => array(
        'edit-options-expose-use-operator' => array(
          1,
        ),
      ),
    );
    $form['expose']['limit_operators'] = array(
      '#type' => 'checkbox',
      '#title' => t('Limit operators'),
      '#description' => t('When checked, the operator will be exposed to the user'),
      '#default_value' => !empty($this->options['expose']['limit_operators']),
      '#process' => array(
        'views_process_dependency',
      ),
      '#dependency' => array(
        'edit-options-expose-use-operator' => array(
          1,
        ),
      ),
      '#description' => t('Restrict which operators will be available to select in the exposed operator form.'),
    );
    $operator_options = $this
      ->operator_options();
    if (count($operator_options)) {
      $form['expose']['available_operators'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Limit the exposed operators'),
        '#default_value' => $this->options['expose']['available_operators'],
        '#prefix' => '<div id="edit-options-expose-available-operators-wrapper"><div id = "edit-options-expose-available-operators">',
        '#suffix' => '</div></div>',
        '#description' => t('Select which operators will be available to select in the exposed operator form. If none is selected, all the operators listed here will be used.'),
        '#options' => $operator_options,
        '#process' => array(
          'expand_checkboxes',
          'views_process_dependency',
        ),
        '#dependency' => array(
          'edit-options-expose-limit-operators' => array(
            1,
          ),
        ),
      );
    }
  }
  else {
    $form['expose']['operator'] = array(
      '#type' => 'value',
      '#value' => '',
    );
  }
  $form['expose']['identifier'] = array(
    '#type' => 'textfield',
    '#default_value' => $this->options['expose']['identifier'],
    '#title' => t('Filter identifier'),
    '#size' => 40,
    '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
  );
  $form['expose']['label'] = array(
    '#type' => 'textfield',
    '#default_value' => $this->options['expose']['label'],
    '#title' => t('Label'),
    '#size' => 40,
  );
}