function LayoutBuilderWidget::layoutBuilderElementGetKeys

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::layoutBuilderElementGetKeys()
  2. 10 core/modules/layout_builder/src/Plugin/Field/FieldWidget/LayoutBuilderWidget.php \Drupal\layout_builder\Plugin\Field\FieldWidget\LayoutBuilderWidget::layoutBuilderElementGetKeys()
  3. 11.x core/modules/layout_builder/src/Plugin/Field/FieldWidget/LayoutBuilderWidget.php \Drupal\layout_builder\Plugin\Field\FieldWidget\LayoutBuilderWidget::layoutBuilderElementGetKeys()

Form element #process callback.

Save the layout builder element array parents as a property on the top form element so that they can be used to access the element within the whole render array later.

See also

\Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController

File

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

Class

LayoutBuilderWidget
A widget to display the layout form.

Namespace

Drupal\layout_builder\Plugin\Field\FieldWidget

Code

public static function layoutBuilderElementGetKeys(array $element, FormStateInterface $form_state, &$form) {
    $form['#layout_builder_element_keys'] = $element['#array_parents'];
    return $element;
}

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