public function TermReference::buildExtraOptionsForm in EntityFieldQuery Views Backend 8
Provide a form for setting options.
Overrides HandlerBase::buildExtraOptionsForm
File
- src/
Plugin/ views/ filter/ TermReference.php, line 64 - Contains \Drupal\efq_views\Plugin\views\filter\FieldInOperator.
Class
- TermReference
- Filter by term id.
Namespace
Drupal\efq_views\Plugin\views\filterCode
public function buildExtraOptionsForm(&$form, FormStateInterface $form_state) {
$vocabularies = taxonomy_get_vocabularies();
$options = array();
foreach ($vocabularies as $voc) {
$options[$voc->machine_name] = check_plain($voc->name);
}
if ($this->options['limit']) {
// We only do this when the form is displayed.
if (empty($this->options['vocabulary'])) {
$first_vocabulary = reset($vocabularies);
$this->options['vocabulary'] = $first_vocabulary->machine_name;
}
if (empty($this->definition['vocabulary'])) {
$form['vocabulary'] = array(
'#type' => 'radios',
'#title' => t('Vocabulary'),
'#options' => $options,
'#description' => t('Select which vocabulary to show terms for in the regular options.'),
'#default_value' => $this->options['vocabulary'],
);
}
}
$form['type'] = array(
'#type' => 'radios',
'#title' => t('Selection type'),
'#options' => array(
'select' => t('Dropdown'),
'textfield' => t('Autocomplete'),
),
'#default_value' => $this->options['type'],
);
}