You are here

function better_statistics_handler_argument_path::options_form in Better Statistics 7

Build the options form.

Overrides views_handler_argument_string::options_form

File

views/better_statistics_handler_argument_path.inc, line 25
Contains the path argument default plugin.

Class

better_statistics_handler_argument_path
Contextual filter for path.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // Do not allow multiple values.
  unset($form['break_phrase']);

  // Prefix field.
  $form['prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Prefix'),
    '#description' => t('Use this to prepend a string to the path you are checking.'),
    '#default_value' => $this->options['prefix'],
    '#fieldset' => 'more',
  );

  // Suffix field.
  $form['suffix'] = array(
    '#type' => 'textfield',
    '#title' => t('Suffix'),
    '#description' => t('Use this to append a string to the path you are checking.'),
    '#default_value' => $this->options['suffix'],
    '#fieldset' => 'more',
  );

  // Operator field.
  $form['operator'] = array(
    '#type' => 'select',
    '#title' => t('Operator'),
    '#description' => t('The operator used when building the condition.'),
    '#default_value' => $this->options['operator'],
    '#options' => array(
      '=' => t('Is equal to'),
      '!=' => t('Is not equal to'),
      'contains' => t('Contains'),
      'starts' => t('Starts with'),
      'not_starts' => t('Does not start with'),
      'ends' => t('Ends with'),
      'not_ends' => t('Does not end with'),
      'not' => t('Does not contain'),
    ),
    '#fieldset' => 'more',
  );

  // Bit of a hacky way to force OR functionality for contextual filters.
  $form['and_or'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use OR instead of AND logic'),
    '#default_value' => $this->options['and_or'],
    '#fieldset' => 'more',
  );
}