BooleanData.php

Same filename in other branches
  1. 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/BooleanData.php
  2. 8.9.x core/lib/Drupal/Core/TypedData/Plugin/DataType/BooleanData.php
  3. 10 core/lib/Drupal/Core/TypedData/Plugin/DataType/BooleanData.php

Namespace

Drupal\Core\TypedData\Plugin\DataType

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/BooleanData.php

View source
<?php

namespace Drupal\Core\TypedData\Plugin\DataType;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\TypedData\Attribute\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.
 */
class BooleanData extends PrimitiveBase implements BooleanInterface {
    
    /**
     * {@inheritdoc}
     */
    public function getCastedValue() {
        return (bool) $this->value;
    }

}

Classes

Title Deprecated Summary
BooleanData The boolean data type.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.