public function Boolean::init in Views (for Drupal 7) 8.3
Overrides Drupal\views\Plugin\views\HandlerBase::init().
Overrides FieldPluginBase::init
File
- lib/
Drupal/ views/ Plugin/ views/ field/ Boolean.php, line 43 - Definition of Drupal\views\Plugin\views\field\Boolean.
Class
- Boolean
- A handler to provide proper displays for booleans.
Namespace
Drupal\views\Plugin\views\fieldCode
public function init(ViewExecutable $view, &$options) {
parent::init($view, $options);
$default_formats = array(
'yes-no' => array(
t('Yes'),
t('No'),
),
'true-false' => array(
t('True'),
t('False'),
),
'on-off' => array(
t('On'),
t('Off'),
),
'enabled-disabled' => array(
t('Enabled'),
t('Disabled'),
),
'boolean' => array(
1,
0,
),
'unicode-yes-no' => array(
'✔',
'✖',
),
);
$output_formats = isset($this->definition['output formats']) ? $this->definition['output formats'] : array();
$this->formats = array_merge($default_formats, $output_formats);
}