function LayoutBuilderWidget::formElement

Same name in other branches
  1. 9 core/modules/layout_builder/src/Plugin/Field/FieldWidget/LayoutBuilderWidget.php \Drupal\layout_builder\Plugin\Field\FieldWidget\LayoutBuilderWidget::formElement()
  2. 8.9.x 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 29

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.