public function EntityAdapter::setValue in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php \Drupal\Core\Entity\Plugin\DataType\EntityAdapter::setValue()
Sets the data value.
Parameters
mixed|null $value: The value to set in the format as documented for the data type or NULL to unset the data value.
bool $notify: (optional) Whether to notify the parent object of the change. Defaults to TRUE. If a property is updated from a parent object, set it to FALSE to avoid being notified again.
Throws
\InvalidArgumentException If the value input is inappropriate.
\Drupal\Core\TypedData\Exception\ReadOnlyException If the data is read-only.
Overrides TypedData::setValue
File
- core/
lib/ Drupal/ Core/ Entity/ Plugin/ DataType/ EntityAdapter.php, line 70 - Contains \Drupal\Core\Entity\Plugin\DataType\EntityAdapter.
Class
- EntityAdapter
- Defines the "entity" data type.
Namespace
Drupal\Core\Entity\Plugin\DataTypeCode
public function setValue($entity, $notify = TRUE) {
$this->entity = $entity;
// Notify the parent of any changes.
if ($notify && isset($this->parent)) {
$this->parent
->onChange($this->name);
}
}