FieldItemBase::writePropertyValue

protected FieldItemBase::writePropertyValue($property_name, $value)

Different to the parent Map class, we avoid creating property objects as far as possible in order to optimize performance. Thus we just update $this->values if no property object has been created yet.

Overrides Map::writePropertyValue

File

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

Class

FieldItemBase
An entity field item.

Namespace

Drupal\Core\Field

Code

protected function writePropertyValue($property_name, $value) {
  // 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);
  }
  // Allow setting plain values for not-defined properties also.
  else {
    $this->values[$property_name] = $value;
  }
}
doc_Drupal
2016-10-29 09:11:39
Comments
Leave a Comment

Please login to continue.