function views_handler_argument_string::options_form

Same name in other branches
  1. 7.x-3.x handlers/views_handler_argument_string.inc \views_handler_argument_string::options_form()

Overrides views_handler_argument::options_form

File

handlers/views_handler_argument_string.inc, line 40

Class

views_handler_argument_string
Basic argument handler to implement string arguments that may have length limits.

Code

function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $form['glossary'] = array(
        '#type' => 'checkbox',
        '#title' => t('Glossary mode'),
        '#description' => t('Glossary mode applies a limit to the number of characters used in the argument, which allows the summary view to act as a glossary.'),
        '#default_value' => $this->options['glossary'],
    );
    $form['ignorecase'] = array(
        '#type' => 'checkbox',
        '#title' => t('Ignore case'),
        '#description' => t('Ignore case allows for doing database searches without case sensitivity. MySQL already works in lower-case mode, so MySQL users should leave this unchecked to improve performance.'),
        '#default_value' => $this->options['ignorecase'],
    );
    $form['limit'] = array(
        '#type' => 'textfield',
        '#title' => t('Character limit'),
        '#description' => t('How many characters of the argument to filter against. If set to 1, all fields starting with the letter in the argument would be matched.'),
        '#default_value' => $this->options['limit'],
        '#process' => array(
            'views_process_dependency',
        ),
        '#dependency' => array(
            'edit-options-glossary' => array(
                TRUE,
            ),
        ),
    );
    $form['case'] = array(
        '#type' => 'select',
        '#title' => t('Case'),
        '#description' => t('When printing the argument result, how to transform the case.'),
        '#options' => array(
            'none' => t('No transform'),
            'upper' => t('Upper case'),
            'lower' => t('Lower case'),
            'ucfirst' => t('Capitalize first letter'),
            'ucwords' => t('Capitalize each word'),
        ),
        '#default_value' => $this->options['case'],
    );
    $form['path_case'] = array(
        '#type' => 'select',
        '#title' => t('Case in path'),
        '#description' => t('When printing url paths, how to transform the case of the argument. Do not use this unless with Postgres as it uses case sensitive comparisons.'),
        '#options' => array(
            'none' => t('No transform'),
            'upper' => t('Upper case'),
            'lower' => t('Lower case'),
            'ucfirst' => t('Capitalize first letter'),
            'ucwords' => t('Capitalize each word'),
        ),
        '#default_value' => $this->options['path_case'],
    );
    $form['transform_dash'] = array(
        '#type' => 'checkbox',
        '#title' => t('Transform spaces to dashes in URL'),
        '#default_value' => $this->options['transform_dash'],
    );
    if (!empty($this->definition['many to one'])) {
        $form['add_table'] = array(
            '#type' => 'checkbox',
            '#title' => t('Allow multiple arguments to work together'),
            '#description' => t('If selected, multiple instances of this argument can work together, as though multiple terms were supplied to the same argument. This setting is not compatible with the "Reduce duplicates" setting.'),
            '#default_value' => !empty($this->options['add_table']),
        );
        $form['require_value'] = array(
            '#type' => 'checkbox',
            '#title' => t('Do not display items with no value in summary'),
            '#default_value' => !empty($this->options['require_value']),
        );
    }
    // allow + for or, , for and
    $form['break_phrase'] = array(
        '#type' => 'checkbox',
        '#title' => t('Allow multiple terms per argument'),
        '#description' => t('If selected, users can enter multiple arguments in the form of 1+2+3 or 1,2,3.'),
        '#default_value' => !empty($this->options['break_phrase']),
    );
}