You are here

function field_layout_form_alter in Drupal 9

Same name and namespace in other branches
  1. 8 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
Provides hook implementations for Field Layout.

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);
    }
  }
}