public function Map::set

Implements \Drupal\Core\TypedData\ComplexDataInterface::set().

Overrides ComplexDataInterface::set

1 method overrides Map::set()
FieldItemBase::set in drupal/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php
Overrides \Drupal\Core\TypedData\Type\Map::set().

File

drupal/core/lib/Drupal/Core/TypedData/Type/Map.php, line 127
Contains \Drupal\Core\TypedData\Type\Map.

Class

Map
The "map" data type.

Namespace

Drupal\Core\TypedData\Type

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);
  }
  if ($this
    ->getPropertyDefinition($property_name)) {
    $this
      ->get($property_name)
      ->setValue($value);
  }
  else {

    // Just set the plain value, which allows adding a new entry to the map.
    $this->values[$property_name] = $value;
  }
}