function LayoutBuilderTestHooks::formLayoutBuilderConfigureBlockAlter

Implements hook_form_BASE_FORM_ID_alter() for layout_builder_configure_block.

File

core/modules/layout_builder/tests/modules/layout_builder_test/src/Hook/LayoutBuilderTestHooks.php, line 66

Class

LayoutBuilderTestHooks
Hook implementations for layout_builder_test.

Namespace

Drupal\layout_builder_test\Hook

Code

public function formLayoutBuilderConfigureBlockAlter(&$form, FormStateInterface $form_state, $form_id) : void {
    
    /** @var \Drupal\layout_builder\Form\ConfigureBlockFormBase $form_object */
    $form_object = $form_state->getFormObject();
    $form['layout_builder_test']['storage'] = [
        '#type' => 'item',
        '#title' => 'Layout Builder Storage: ' . $form_object->getSectionStorage()
            ->getStorageId(),
    ];
    $form['layout_builder_test']['section'] = [
        '#type' => 'item',
        '#title' => 'Layout Builder Section: ' . $form_object->getCurrentSection()
            ->getLayoutId(),
    ];
    $form['layout_builder_test']['component'] = [
        '#type' => 'item',
        '#title' => 'Layout Builder Component: ' . $form_object->getCurrentComponent()
            ->getPluginId(),
    ];
}

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