public function TaxonomyIndexTid::buildOptionsForm

Provide "link to term" option.

Overrides PrerenderList::buildOptionsForm

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php, line 52
Definition of Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid.

Class

TaxonomyIndexTid
Field handler to display all taxonomy terms of a node.

Namespace

Drupal\taxonomy\Plugin\views\field

Code

public function buildOptionsForm(&$form, &$form_state) {
  $form['link_to_taxonomy'] = array(
    '#title' => t('Link this field to its term page'),
    '#type' => 'checkbox',
    '#default_value' => !empty($this->options['link_to_taxonomy']),
  );
  $form['limit'] = array(
    '#type' => 'checkbox',
    '#title' => t('Limit terms by vocabulary'),
    '#default_value' => $this->options['limit'],
  );
  $options = array();
  $vocabularies = entity_load_multiple('taxonomy_vocabulary');
  foreach ($vocabularies as $voc) {
    $options[$voc
      ->id()] = $voc
      ->label();
  }
  $form['vids'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Vocabularies'),
    '#options' => $options,
    '#default_value' => $this->options['vids'],
    '#states' => array(
      'visible' => array(
        ':input[name="options[limit]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  parent::buildOptionsForm($form, $form_state);
}