function SectionData::setValue

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Plugin/DataType/SectionData.php \Drupal\layout_builder\Plugin\DataType\SectionData::setValue()
  2. 8.9.x core/modules/layout_builder/src/Plugin/DataType/SectionData.php \Drupal\layout_builder\Plugin\DataType\SectionData::setValue()
  3. 10 core/modules/layout_builder/src/Plugin/DataType/SectionData.php \Drupal\layout_builder\Plugin\DataType\SectionData::setValue()

Overrides TypedData::setValue

File

core/modules/layout_builder/src/Plugin/DataType/SectionData.php, line 33

Class

SectionData
Provides a data type wrapping <a href="/api/drupal/core%21modules%21layout_builder%21src%21Section.php/class/Section/11.x" title="Provides a domain object for layout sections." class="local">\Drupal\layout_builder\Section</a>.

Namespace

Drupal\layout_builder\Plugin\DataType

Code

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.