public function FieldItemBase::set

Overrides \Drupal\Core\TypedData\Type\Map::set().

Overrides Map::set

2 calls to FieldItemBase::set()
FieldItemBase::__set in drupal/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php
Implements \Drupal\Core\Entity\Field\FieldItemInterface::__set().
FieldItemBase::__unset in drupal/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php
Implements \Drupal\Core\Entity\Field\FieldItemInterface::__unset().

File

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

Class

FieldItemBase
An entity field item.

Namespace

Drupal\Core\Entity\Field

Code

public function set($property_name, $value, $notify = TRUE) {

  // Notify the parent of any changes to be made.
  if ($notify && isset($this->parent)) {
    $this->parent
      ->onChange($this->name);
  }

  // For defined properties there is either a property object or a plain
  // value that needs to be updated.
  if (isset($this->properties[$property_name])) {
    $this->properties[$property_name]
      ->setValue($value, FALSE);
    unset($this->values[$property_name]);
  }
  else {
    $this->values[$property_name] = $value;
  }
}