function Section::getComponent

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

Gets the component for a given UUID.

Parameters

string $uuid: The UUID of the component to retrieve.

Return value

\Drupal\layout_builder\SectionComponent The component.

Throws

\InvalidArgumentException Thrown when the expected UUID does not exist.

File

core/modules/layout_builder/src/Section.php, line 175

Class

Section
Provides a domain object for layout sections.

Namespace

Drupal\layout_builder

Code

public function getComponent($uuid) {
    if (!isset($this->components[$uuid])) {
        throw new \InvalidArgumentException(sprintf('Invalid UUID "%s"', $uuid));
    }
    return $this->components[$uuid];
}

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