Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SectionComponent.php

function SectionComponent::getPlugin

Gets the plugin for this component.

Parameters

\Drupal\Core\Plugin\Context\ContextInterface[] $contexts: An array of contexts to set on the plugin.

Return value

\Drupal\Component\Plugin\PluginInspectionInterface The plugin.

File

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

Class

SectionComponent
Provides a value object for a section component.

Namespace

Drupal\layout_builder

Code

public function getPlugin(array $contexts = []) {
    $plugin = $this->pluginManager()
        ->createInstance($this->getPluginId(), $this->getConfiguration());
    if ($contexts && $plugin instanceof ContextAwarePluginInterface) {
        $this->contextHandler()
            ->applyContextMapping($plugin, $contexts);
    }
    return $plugin;
}
RSS feed
Powered by Drupal