function Tid::buildOptionsForm
Same name in other branches
- 9 core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php \Drupal\taxonomy\Plugin\views\argument_default\Tid::buildOptionsForm()
- 10 core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php \Drupal\taxonomy\Plugin\views\argument_default\Tid::buildOptionsForm()
- 11.x core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php \Drupal\taxonomy\Plugin\views\argument_default\Tid::buildOptionsForm()
Overrides ArgumentDefaultPluginBase::buildOptionsForm
File
-
core/
modules/ taxonomy/ src/ Plugin/ views/ argument_default/ Tid.php, line 111
Class
- Tid
- Taxonomy tid default argument.
Namespace
Drupal\taxonomy\Plugin\views\argument_defaultCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['term_page'] = [
'#type' => 'checkbox',
'#title' => $this->t('Load default filter from term page'),
'#default_value' => $this->options['term_page'],
];
$form['node'] = [
'#type' => 'checkbox',
'#title' => $this->t("Load default filter from node page, that's good for related taxonomy blocks"),
'#default_value' => $this->options['node'],
];
$form['limit'] = [
'#type' => 'checkbox',
'#title' => $this->t('Limit terms by vocabulary'),
'#default_value' => $this->options['limit'],
'#states' => [
'visible' => [
':input[name="options[argument_default][taxonomy_tid][node]"]' => [
'checked' => TRUE,
],
],
],
];
$options = [];
$vocabularies = $this->vocabularyStorage
->loadMultiple();
foreach ($vocabularies as $voc) {
$options[$voc->id()] = $voc->label();
}
$form['vids'] = [
'#type' => 'checkboxes',
'#title' => $this->t('Vocabularies'),
'#options' => $options,
'#default_value' => $this->options['vids'],
'#states' => [
'visible' => [
':input[name="options[argument_default][taxonomy_tid][limit]"]' => [
'checked' => TRUE,
],
':input[name="options[argument_default][taxonomy_tid][node]"]' => [
'checked' => TRUE,
],
],
],
];
$form['anyall'] = [
'#type' => 'radios',
'#title' => $this->t('Multiple-value handling'),
'#default_value' => $this->options['anyall'],
'#options' => [
',' => $this->t('Filter to items that share all terms'),
'+' => $this->t('Filter to items that share any term'),
],
'#states' => [
'visible' => [
':input[name="options[argument_default][taxonomy_tid][node]"]' => [
'checked' => TRUE,
],
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.