function LayoutBuilderWidget::formElement

Same name in other branches
  1. 8.9.x core/modules/layout_builder/src/Plugin/Field/FieldWidget/LayoutBuilderWidget.php \Drupal\layout_builder\Plugin\Field\FieldWidget\LayoutBuilderWidget::formElement()
  2. 10 core/modules/layout_builder/src/Plugin/Field/FieldWidget/LayoutBuilderWidget.php \Drupal\layout_builder\Plugin\Field\FieldWidget\LayoutBuilderWidget::formElement()
  3. 11.x core/modules/layout_builder/src/Plugin/Field/FieldWidget/LayoutBuilderWidget.php \Drupal\layout_builder\Plugin\Field\FieldWidget\LayoutBuilderWidget::formElement()

Overrides WidgetInterface::formElement

File

core/modules/layout_builder/src/Plugin/Field/FieldWidget/LayoutBuilderWidget.php, line 30

Class

LayoutBuilderWidget
A widget to display the layout form.

Namespace

Drupal\layout_builder\Plugin\Field\FieldWidget

Code

public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    $element += [
        '#type' => 'layout_builder',
        '#section_storage' => $this->getSectionStorage($form_state),
    ];
    $element['#process'][] = [
        static::class,
        'layoutBuilderElementGetKeys',
    ];
    return $element;
}

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