function LayoutBuilderHooks::formEntityFormDisplayEditFormAlter

Implements hook_form_FORM_ID_alter() for \Drupal\field_ui\Form\EntityFormDisplayEditForm.

File

core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php, line 101

Class

LayoutBuilderHooks
Hook implementations for layout_builder.

Namespace

Drupal\layout_builder\Hook

Code

public function formEntityFormDisplayEditFormAlter(&$form, FormStateInterface $form_state) : void {
    // Hides the Layout Builder field. It is rendered directly in
    // \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::buildMultiple().
    unset($form['fields'][OverridesSectionStorage::FIELD_NAME]);
    $key = array_search(OverridesSectionStorage::FIELD_NAME, $form['#fields']);
    if ($key !== FALSE) {
        unset($form['#fields'][$key]);
    }
}

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