public function FieldItemBase::__clone

Implements a deep clone.

File

drupal/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php, line 270
Definition of Drupal\Core\Entity\Field\FieldItemBase.

Class

FieldItemBase
An entity field item.

Namespace

Drupal\Core\Entity\Field

Code

public function __clone() {
  foreach ($this->properties as $name => $property) {
    $this->properties[$name] = clone $property;
    if ($property instanceof ContextAwareInterface) {
      $this->properties[$name]
        ->setParent($this);
    }
  }
}