You are here

protected function ConfigureSectionForm::getPluginForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Form/ConfigureSectionForm.php \Drupal\layout_builder\Form\ConfigureSectionForm::getPluginForm()

Retrieves the plugin form for a given layout.

Parameters

\Drupal\Core\Layout\LayoutInterface $layout: The layout plugin.

Return value

\Drupal\Core\Plugin\PluginFormInterface The plugin form for the layout.

File

core/modules/layout_builder/src/Form/ConfigureSectionForm.php, line 212

Class

ConfigureSectionForm
Provides a form for configuring a layout section.

Namespace

Drupal\layout_builder\Form

Code

protected function getPluginForm(LayoutInterface $layout) {
  if ($layout instanceof PluginWithFormsInterface) {
    return $this->pluginFormFactory
      ->createInstance($layout, 'configure');
  }
  if ($layout instanceof PluginFormInterface) {
    return $layout;
  }
  throw new \InvalidArgumentException(sprintf('The "%s" layout does not provide a configuration form', $layout
    ->getPluginId()));
}