function layout_builder_form_entity_form_display_edit_form_alter

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/layout_builder.module \layout_builder_form_entity_form_display_edit_form_alter()
  2. 8.9.x core/modules/layout_builder/layout_builder.module \layout_builder_form_entity_form_display_edit_form_alter()
  3. 10 core/modules/layout_builder/layout_builder.module \layout_builder_form_entity_form_display_edit_form_alter()

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

File

core/modules/layout_builder/layout_builder.module, line 90

Code

function layout_builder_form_entity_form_display_edit_form_alter(&$form, FormStateInterface $form_state) {
    // 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.