Options form subform for setting options.
This should be overridden by all child classes and it must define $form['value']
Overrides FilterPluginBase::valueForm
buildOptionsForm()
protected function valueForm(&$form, &$form_state) {
if (empty($this->value_options)) {
// Initialize the array of possible values for this filter.
$this
->getValueOptions();
}
if (!empty($form_state['exposed'])) {
// Exposed filter: use a select box to save space.
$filter_form_type = 'select';
}
else {
// Configuring a filter: use radios for clarity.
$filter_form_type = 'radios';
}
$form['value'] = array(
'#type' => $filter_form_type,
'#title' => $this->value_value,
'#options' => $this->value_options,
'#default_value' => $this->value,
);
if (!empty($this->options['exposed'])) {
$identifier = $this->options['expose']['identifier'];
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
$form_state['input'][$identifier] = $this->value;
}
// If we're configuring an exposed filter, add an <Any> option.
if (empty($form_state['exposed']) || empty($this->options['expose']['required'])) {
$any_label = config('views.settings')
->get('ui.exposed_filter_any_label') == 'old_any' ? '<Any>' : t('- Any -');
if ($form['value']['#type'] != 'select') {
$any_label = check_plain($any_label);
}
$form['value']['#options'] = array(
'All' => $any_label,
) + $form['value']['#options'];
}
}
}