function ConfigureSectionForm::getPluginForm

Same name in other branches
  1. 9 core/modules/layout_builder/src/Form/ConfigureSectionForm.php \Drupal\layout_builder\Form\ConfigureSectionForm::getPluginForm()
  2. 10 core/modules/layout_builder/src/Form/ConfigureSectionForm.php \Drupal\layout_builder\Form\ConfigureSectionForm::getPluginForm()
  3. 11.x 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 190

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()));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.