You are here

public function LayoutParagraphsSection::getComponent in Layout Paragraphs 2.0.x

Wraps the paragraph is the correct component class.

Parameters

Drupal\paragraphs\Entity\Paragraph $paragraph: The paragraph entity.

Return value

LayoutParagraphsComponent|LayoutParagraphsSection The component.

File

src/LayoutParagraphsSection.php, line 51

Class

LayoutParagraphsSection
Provides a domain object for a Layout Paragraphs Section.

Namespace

Drupal\layout_paragraphs

Code

public function getComponent(Paragraph $paragraph) {
  foreach ($this->components as $component) {
    if ($component
      ->getEntity()
      ->uuid() == $paragraph
      ->uuid()) {
      return $component;
    }
  }
}