You are here

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

Same name and namespace in other branches
  1. 6.3 modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc \views_plugin_argument_default_taxonomy_tid::options_form()

Provide the default form for setting options.

Overrides views_plugin_argument_default::options_form

File

modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc, line 48
Definition of views_plugin_argument_default_taxonomy_tid.

Class

views_plugin_argument_default_taxonomy_tid
Taxonomy tid default argument.

Code

public function options_form(&$form, &$form_state) {
  $form['term_page'] = array(
    '#type' => 'checkbox',
    '#title' => t('Load default filter from term page'),
    '#default_value' => $this->options['term_page'],
  );
  $form['node'] = array(
    '#type' => 'checkbox',
    '#title' => t('Load default filter from node page, that\'s good for related taxonomy blocks'),
    '#default_value' => $this->options['node'],
  );
  $form['limit'] = array(
    '#type' => 'checkbox',
    '#title' => t('Limit terms by vocabulary'),
    '#default_value' => $this->options['limit'],
    '#process' => array(
      'form_process_checkbox',
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-options-argument-default-taxonomy-tid-node' => array(
        1,
      ),
    ),
  );
  $options = array();
  $vocabularies = taxonomy_get_vocabularies();
  foreach ($vocabularies as $voc) {
    $options[$voc->machine_name] = check_plain($voc->name);
  }
  $form['vocabularies'] = array(
    '#prefix' => '<div><div id="edit-options-vids">',
    '#suffix' => '</div></div>',
    '#type' => 'checkboxes',
    '#title' => t('Vocabularies'),
    '#options' => $options,
    '#default_value' => $this->options['vocabularies'],
    '#process' => array(
      'form_process_checkboxes',
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-options-argument-default-taxonomy-tid-limit' => array(
        1,
      ),
      'edit-options-argument-default-taxonomy-tid-node' => array(
        1,
      ),
    ),
  );
  $form['anyall'] = array(
    '#type' => 'radios',
    '#title' => t('Multiple-value handling'),
    '#default_value' => $this->options['anyall'],
    '#process' => array(
      'form_process_radios',
      'ctools_dependent_process',
    ),
    '#options' => array(
      ',' => t('Filter to items that share all terms'),
      '+' => t('Filter to items that share any term'),
    ),
    '#dependency' => array(
      'edit-options-argument-default-taxonomy-tid-node' => array(
        1,
      ),
    ),
  );
}