You are here

protected function EntityReferenceLayoutWidget::getLayoutPluginForm in Entity Reference with Layout 8

Retrieves the plugin form for a given layout.

Parameters

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

Return value

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

2 calls to EntityReferenceLayoutWidget::getLayoutPluginForm()
EntityReferenceLayoutWidget::formElement in src/Plugin/Field/FieldWidget/EntityReferenceLayoutWidget.php
Builds the widget form array for an individual item.
EntityReferenceLayoutWidget::saveItemSubmit in src/Plugin/Field/FieldWidget/EntityReferenceLayoutWidget.php
Form submit handler - saves an item.

File

src/Plugin/Field/FieldWidget/EntityReferenceLayoutWidget.php, line 1373

Class

EntityReferenceLayoutWidget
Entity Reference with Layout field widget.

Namespace

Drupal\entity_reference_layout\Plugin\Field\FieldWidget

Code

protected function getLayoutPluginForm(LayoutInterface $layout) {
  if ($layout instanceof PluginWithFormsInterface) {
    try {
      return $this->pluginFormFactory
        ->createInstance($layout, 'configure');
    } catch (\Exception $e) {
      watchdog_exception('Erl, Layout Configuration', $e);
    }
  }
  if ($layout instanceof PluginFormInterface) {
    return $layout;
  }
  return NULL;
}