function FieldItemBase::__set

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Field/FieldItemBase.php \Drupal\Core\Field\FieldItemBase::__set()
  2. 10 core/lib/Drupal/Core/Field/FieldItemBase.php \Drupal\Core\Field\FieldItemBase::__set()
  3. 11.x core/lib/Drupal/Core/Field/FieldItemBase.php \Drupal\Core\Field\FieldItemBase::__set()

Overrides FieldItemInterface::__set

1 method overrides FieldItemBase::__set()
MapItem::__set in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/MapItem.php
Magic method: Sets a property value.

File

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

Class

FieldItemBase
An entity field item.

Namespace

Drupal\Core\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);
}

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