You are here

public function Boolean::init in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/field/Boolean.php \Drupal\views\Plugin\views\field\Boolean::init()

Initialize the plugin.

Parameters

\Drupal\views\ViewExecutable $view: The view object.

\Drupal\views\Plugin\views\display\DisplayPluginBase $display: The display handler.

array $options: The options configured for this plugin.

Overrides FieldPluginBase::init

File

core/modules/views/src/Plugin/views/field/Boolean.php, line 53
Contains \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 init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);
  $default_formats = array(
    'yes-no' => array(
      t('Yes'),
      $this
        ->t('No'),
    ),
    'true-false' => array(
      t('True'),
      $this
        ->t('False'),
    ),
    'on-off' => array(
      t('On'),
      $this
        ->t('Off'),
    ),
    'enabled-disabled' => array(
      t('Enabled'),
      $this
        ->t('Disabled'),
    ),
    'boolean' => array(
      1,
      0,
    ),
    'unicode-yes-no' => array(
      '✔',
      '✖',
    ),
  );
  $output_formats = isset($this->definition['output formats']) ? $this->definition['output formats'] : array();
  $custom_format = array(
    'custom' => array(
      t('Custom'),
    ),
  );
  $this->formats = array_merge($default_formats, $output_formats, $custom_format);
}