You are here

public function Boolean::buildOptionsForm in Views (for Drupal 7) 8.3

Default options form that provides the label widget that all fields should have.

Overrides FieldPluginBase::buildOptionsForm

File

lib/Drupal/views/Plugin/views/field/Boolean.php, line 58
Definition of Drupal\views\Plugin\views\field\Boolean.

Class

Boolean
A handler to provide proper displays for booleans.

Namespace

Drupal\views\Plugin\views\field

Code

public function buildOptionsForm(&$form, &$form_state) {
  foreach ($this->formats as $key => $item) {
    $options[$key] = implode('/', $item);
  }
  $form['type'] = array(
    '#type' => 'select',
    '#title' => t('Output format'),
    '#options' => $options,
    '#default_value' => $this->options['type'],
  );
  $form['not'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reverse'),
    '#description' => t('If checked, true will be displayed as false.'),
    '#default_value' => $this->options['not'],
  );
  parent::buildOptionsForm($form, $form_state);
}