public function TaxonomyIndexTid::buildOptionsForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php \Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid::buildOptionsForm()
Provide "link to term" option.
Overrides PrerenderList::buildOptionsForm
File
- core/
modules/ taxonomy/ src/ Plugin/ views/ field/ TaxonomyIndexTid.php, line 90 - Contains \Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid.
Class
- TaxonomyIndexTid
- Field handler to display all taxonomy terms of a node.
Namespace
Drupal\taxonomy\Plugin\views\fieldCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['link_to_taxonomy'] = array(
'#title' => $this
->t('Link this field to its term page'),
'#type' => 'checkbox',
'#default_value' => !empty($this->options['link_to_taxonomy']),
);
$form['limit'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Limit terms by vocabulary'),
'#default_value' => $this->options['limit'],
);
$options = array();
$vocabularies = $this->vocabularyStorage
->loadMultiple();
foreach ($vocabularies as $voc) {
$options[$voc
->id()] = $voc
->label();
}
$form['vids'] = array(
'#type' => 'checkboxes',
'#title' => $this
->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);
}