function SectionComponent::set

Same name in other branches
  1. 9 core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\SectionComponent::set()
  2. 10 core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\SectionComponent::set()
  3. 11.x core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\SectionComponent::set()

Sets a value to an arbitrary property for the component.

Parameters

string $property: The property to use for the value.

mixed $value: The value to set.

Return value

$this

File

core/modules/layout_builder/src/SectionComponent.php, line 125

Class

SectionComponent
Provides a value object for a section component.

Namespace

Drupal\layout_builder

Code

public function set($property, $value) {
    if (property_exists($this, $property)) {
        $this->{$property} = $value;
    }
    else {
        $this->additional[$property] = $value;
    }
    return $this;
}

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