You are here

public function views_handler_field_boolean::init in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 handlers/views_handler_field_boolean.inc \views_handler_field_boolean::init()
  2. 6.2 handlers/views_handler_field_boolean.inc \views_handler_field_boolean::init()

Init the handler with necessary data.

Parameters

view $view: The $view object this handler is attached to.

array $options: The item from the database; the actual contents of this will vary based upon the type of handler.

Overrides views_handler_field::init

File

handlers/views_handler_field_boolean.inc, line 42
Definition of views_handler_field_boolean.

Class

views_handler_field_boolean
A handler to provide proper displays for booleans.

Code

public function init(&$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();
  $custom_format = array(
    'custom' => array(
      t('Custom'),
    ),
  );
  $this->formats = array_merge($default_formats, $output_formats, $custom_format);
}