function field_layout_form_alter

Same name in other branches
  1. 8.9.x core/modules/field_layout/field_layout.module \field_layout_form_alter()
  2. 10 core/modules/field_layout/field_layout.module \field_layout_form_alter()
  3. 11.x core/modules/field_layout/field_layout.module \field_layout_form_alter()

Implements hook_form_alter().

File

core/modules/field_layout/field_layout.module, line 60

Code

function field_layout_form_alter(&$form, FormStateInterface $form_state, $form_id) {
    $form_object = $form_state->getFormObject();
    if ($form_object instanceof ContentEntityFormInterface && ($display = $form_object->getFormDisplay($form_state))) {
        if ($display instanceof EntityDisplayWithLayoutInterface) {
            \Drupal::classResolver(FieldLayoutBuilder::class)->buildForm($form, $display);
        }
    }
}

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