public function SectionData::setValue in Drupal 9
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/Plugin/DataType/SectionData.php \Drupal\layout_builder\Plugin\DataType\SectionData::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/
modules/ layout_builder/ src/ Plugin/ DataType/ SectionData.php, line 32
Class
- SectionData
- Provides a data type wrapping \Drupal\layout_builder\Section.
Namespace
Drupal\layout_builder\Plugin\DataTypeCode
public function setValue($value, $notify = TRUE) {
if ($value && !$value instanceof Section) {
throw new \InvalidArgumentException(sprintf('Value assigned to "%s" is not a valid section', $this
->getName()));
}
parent::setValue($value, $notify);
}