You are here

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

Provide "link to term" option.

Overrides PrerenderList::buildOptionsForm

File

lib/Views/taxonomy/Plugin/views/field/TaxonomyIndexTid.php, line 60
Definition of Views\taxonomy\Plugin\views\field\TaxonomyIndexTid.

Class

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

Namespace

Views\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 = taxonomy_vocabulary_get_names();
  foreach ($vocabularies as $voc) {
    $options[$voc->machine_name] = check_plain($voc->name);
  }
  $form['vocabularies'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Vocabularies'),
    '#options' => $options,
    '#default_value' => $this->options['vocabularies'],
    '#states' => array(
      'visible' => array(
        ':input[name="options[limit]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  parent::buildOptionsForm($form, $form_state);
}