public function FieldItemBase::__set

Implements \Drupal\Core\Entity\Field\FieldItemInterface::__set().

Overrides FieldItemInterface::__set

File

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

Class

FieldItemBase
An entity field item.

Namespace

Drupal\Core\Entity\Field

Code

public function __set($name, $value) {

  // Support setting values via property objects, but take care in as the
  // value of the 'entity' property is typed data also.
  if ($value instanceof TypedDataInterface && !$value instanceof EntityInterface) {
    $value = $value
      ->getValue();
  }
  $this
    ->set($name, $value);
}