public function FieldItemBase::__construct

Overrides \Drupal\Core\TypedData\TypedData::__construct().

Overrides TypedData::__construct

File

drupal/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php, line 28
Contains \Drupal\Core\Entity\Field\FieldItemBase.

Class

FieldItemBase
An entity field item.

Namespace

Drupal\Core\Entity\Field

Code

public function __construct(array $definition, $name = NULL, TypedDataInterface $parent = NULL) {
  parent::__construct($definition, $name, $parent);

  // Initialize computed properties by default, such that they get cloned
  // with the whole item.
  foreach ($this
    ->getPropertyDefinitions() as $name => $definition) {
    if (!empty($definition['computed'])) {
      $this->properties[$name] = \Drupal::typedData()
        ->getPropertyInstance($this, $name);
    }
  }
}