You are here

BooleanData.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/lib/Drupal/Core/TypedData/Plugin/DataType/BooleanData.php

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/BooleanData.php
View source
<?php

/**
 * @file
 * Contains \Drupal\Core\TypedData\Plugin\DataType\BooleanData.
 */
namespace Drupal\Core\TypedData\Plugin\DataType;

use Drupal\Core\TypedData\PrimitiveBase;
use Drupal\Core\TypedData\Type\BooleanInterface;

/**
 * The boolean data type.
 *
 * The plain value of a boolean is a regular PHP boolean. For setting the value
 * any PHP variable that casts to a boolean may be passed.
 *
 * @DataType(
 *   id = "boolean",
 *   label = @Translation("Boolean")
 * )
 */
class BooleanData extends PrimitiveBase implements BooleanInterface {

  /**
   * {@inheritdoc}
   */
  public function getCastedValue() {
    return (bool) $this->value;
  }

}

Classes

Namesort descending Description
BooleanData The boolean data type.