Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldItemBase.php

function FieldItemBase::__construct

Overrides TypedData::__construct

File

core/lib/Drupal/Core/Field/FieldItemBase.php, line 60

Class

FieldItemBase
An entity field item.

Namespace

Drupal\Core\Field

Code

public function __construct(ComplexDataDefinitionInterface $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->definition
        ->getPropertyDefinitions() as $name => $definition) {
        if ($definition->isComputed()) {
            $this->properties[$name] = \Drupal::typedDataManager()->getPropertyInstance($this, $name);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal