public function Tid::buildOptionsForm in Views (for Drupal 7) 8.3
Provide the default form for setting options.
Overrides ArgumentDefaultPluginBase::buildOptionsForm
File
- lib/
Views/ taxonomy/ Plugin/ views/ argument_default/ Tid.php, line 52 - Definition of Views\taxonomy\Plugin\views\argument_default\Tid.
Class
- Tid
- Taxonomy tid default argument.
Namespace
Views\taxonomy\Plugin\views\argument_defaultCode
public function buildOptionsForm(&$form, &$form_state) {
$form['term_page'] = array(
'#type' => 'checkbox',
'#title' => t('Load default filter from term page'),
'#default_value' => $this->options['term_page'],
);
$form['node'] = array(
'#type' => 'checkbox',
'#title' => t('Load default filter from node page, that\'s good for related taxonomy blocks'),
'#default_value' => $this->options['node'],
);
$form['limit'] = array(
'#type' => 'checkbox',
'#title' => t('Limit terms by vocabulary'),
'#default_value' => $this->options['limit'],
'#states' => array(
'visible' => array(
':input[name="options[argument_default][taxonomy_tid][node]"]' => array(
'checked' => TRUE,
),
),
),
);
$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[argument_default][taxonomy_tid][limit]"]' => array(
'checked' => TRUE,
),
':input[name="options[argument_default][taxonomy_tid][node]"]' => array(
'checked' => TRUE,
),
),
),
);
$form['anyall'] = array(
'#type' => 'radios',
'#title' => t('Multiple-value handling'),
'#default_value' => $this->options['anyall'],
'#options' => array(
',' => t('Filter to items that share all terms'),
'+' => t('Filter to items that share any term'),
),
'#states' => array(
'visible' => array(
':input[name="options[argument_default][taxonomy_tid][node]"]' => array(
'checked' => TRUE,
),
),
),
);
}