function FieldLayoutHooks::formAlter

Implements hook_form_alter().

File

core/modules/field_layout/src/Hook/FieldLayoutHooks.php, line 67

Class

FieldLayoutHooks
Hook implementations for field_layout.

Namespace

Drupal\field_layout\Hook

Code

public function formAlter(&$form, FormStateInterface $form_state, $form_id) : void {
    $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.