PrimitiveBase.php

Same filename and directory in other branches
  1. 8.9.x core/lib/Drupal/Core/TypedData/PrimitiveBase.php
  2. 10 core/lib/Drupal/Core/TypedData/PrimitiveBase.php
  3. 11.x core/lib/Drupal/Core/TypedData/PrimitiveBase.php

Namespace

Drupal\Core\TypedData

File

core/lib/Drupal/Core/TypedData/PrimitiveBase.php

View source
<?php

namespace Drupal\Core\TypedData;


/**
 * Base class for primitive data types.
 */
abstract class PrimitiveBase extends TypedData implements PrimitiveInterface {
  
  /**
   * The data value.
   *
   * @var mixed
   */
  protected $value;
  
  /**
   * {@inheritdoc}
   */
  public function getValue() {
    return $this->value;
  }
  
  /**
   * {@inheritdoc}
   */
  public function setValue($value, $notify = TRUE) {
    $this->value = $value;
    // Notify the parent of any changes.
    if ($notify && isset($this->parent)) {
      $this->parent
        ->onChange($this->name);
    }
  }

}

Classes

Title Deprecated Summary
PrimitiveBase Base class for primitive data types.

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