function LayoutBuilder::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 form render array later.

Parameters

array $element: The render array for the layout builder element.

\Drupal\Core\Form\FormStateInterface $form_state: Form state object.

array $form: The render array for the complete form.

Return value

array The layout builder element render array after processing.

See also

\Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController

File

core/modules/layout_builder/src/Element/LayoutBuilder.php, line 107

Class

LayoutBuilder
Defines a render element for building the Layout Builder UI.

Namespace

Drupal\layout_builder\Element

Code

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

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