function SectionComponent::getPlugin
Same name in other branches
- 9 core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\SectionComponent::getPlugin()
- 8.9.x core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\SectionComponent::getPlugin()
- 10 core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\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_builderCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.