Overrides \Drupal\Core\TypedData\TypedData::setValue().
array|null $values: An array of property values.
Overrides Map::setValue
public function setValue($values, $notify = TRUE) {
// Treat the values as property value of the first property, if no array is
// given.
if (isset($values) && !is_array($values)) {
$keys = array_keys($this
->getPropertyDefinitions());
$values = array(
$keys[0] => $values,
);
}
// Notify the parent of any changes to be made.
if ($notify && isset($this->parent)) {
$this->parent
->onChange($this->name);
}
$this->values = $values;
// Update any existing property objects.
foreach ($this->properties as $name => $property) {
$value = NULL;
if (isset($values[$name])) {
$value = $values[$name];
}
$property
->setValue($value, FALSE);
unset($this->values[$name]);
}
}