You are here

public function Term::buildOptionsForm in Views (for Drupal 7) 8.3

Provide the default form for setting options.

Overrides ArgumentValidatorPluginBase::buildOptionsForm

File

lib/Views/taxonomy/Plugin/views/argument_validator/Term.php, line 49
Definition of Views\taxonomy\Plugin\views\argument_validator\Term.

Class

Term
Validate whether an argument is an acceptable node.

Namespace

Views\taxonomy\Plugin\views\argument_validator

Code

public function buildOptionsForm(&$form, &$form_state) {
  $vocabularies = taxonomy_vocabulary_get_names();
  $options = array();
  foreach ($vocabularies as $voc) {
    $options[$voc->machine_name] = check_plain($voc->name);
  }
  $form['vocabularies'] = array(
    '#type' => 'checkboxes',
    '#prefix' => '<div id="edit-options-validate-argument-vocabulary-wrapper">',
    '#suffix' => '</div>',
    '#title' => t('Vocabularies'),
    '#options' => $options,
    '#default_value' => $this->options['vocabularies'],
    '#description' => t('If you wish to validate for specific vocabularies, check them; if none are checked, all terms will pass.'),
  );
  $form['type'] = array(
    '#type' => 'select',
    '#title' => t('Filter value type'),
    '#options' => array(
      'tid' => t('Term ID'),
      'tids' => t('Term IDs separated by , or +'),
      'name' => t('Term name'),
      'convert' => t('Term name converted to Term ID'),
    ),
    '#default_value' => $this->options['type'],
    '#description' => t('Select the form of this filter value; if using term name, it is generally more efficient to convert it to a term ID and use Taxonomy: Term ID rather than Taxonomy: Term Name" as the filter.'),
  );
  $form['transform'] = array(
    '#type' => 'checkbox',
    '#title' => t('Transform dashes in URL to spaces in term name filter values'),
    '#default_value' => $this->options['transform'],
  );
}