public function Boolean::buildOptionsForm in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/field/Boolean.php \Drupal\views\Plugin\views\field\Boolean::buildOptionsForm()
Default options form that provides the label widget that all fields should have.
Overrides FieldPluginBase::buildOptionsForm
File
- core/
modules/ views/ src/ Plugin/ views/ field/ Boolean.php, line 72 - Contains \Drupal\views\Plugin\views\field\Boolean.
Class
- Boolean
- A handler to provide proper displays for booleans.
Namespace
Drupal\views\Plugin\views\fieldCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
foreach ($this->formats as $key => $item) {
$options[$key] = implode('/', $item);
}
$form['type'] = array(
'#type' => 'select',
'#title' => $this
->t('Output format'),
'#options' => $options,
'#default_value' => $this->options['type'],
);
$form['type_custom_true'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Custom output for TRUE'),
'#default_value' => $this->options['type_custom_true'],
'#states' => array(
'visible' => array(
'select[name="options[type]"]' => array(
'value' => 'custom',
),
),
),
);
$form['type_custom_false'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Custom output for FALSE'),
'#default_value' => $this->options['type_custom_false'],
'#states' => array(
'visible' => array(
'select[name="options[type]"]' => array(
'value' => 'custom',
),
),
),
);
$form['not'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Reverse'),
'#description' => $this
->t('If checked, true will be displayed as false.'),
'#default_value' => $this->options['not'],
);
parent::buildOptionsForm($form, $form_state);
}