You are here

public function ChooseComponentController::getAllowedComponentTypes in Layout Paragraphs 2.0.x

Returns an array of allowed component types.

Dispatches a LayoutParagraphsComponentMenuEvent object so the component list can be manipulated based on the layout, the layout settings, the parent uuid, and region.

Parameters

\Drupal\layout_paragraphs\LayoutParagraphsLayout $layout: The layout object.

string $parent_uuid: The parent uuid of paragraph we are inserting a component into.

string $region: The region we are inserting a component into.

Return value

array[] Returns an array of allowed component types.

1 call to ChooseComponentController::getAllowedComponentTypes()
ChooseComponentController::list in src/Controller/ChooseComponentController.php
Builds the component menu.

File

src/Controller/ChooseComponentController.php, line 160

Class

ChooseComponentController
ChooseComponentController controller class.

Namespace

Drupal\layout_paragraphs\Controller

Code

public function getAllowedComponentTypes(LayoutParagraphsLayout $layout, $parent_uuid = NULL, $region = NULL) {
  $component_types = $this
    ->getComponentTypes($layout);
  $event = new LayoutParagraphsAllowedTypesEvent($component_types, $layout, $parent_uuid, $region);
  $this->eventDispatcher
    ->dispatch(LayoutParagraphsAllowedTypesEvent::EVENT_NAME, $event);
  return $event
    ->getTypes();
}