function LayoutBuilderTestEntityHooks::layoutBuilderEntityFormDisplayAlter

Implements hook_entity_form_display_alter().

Attributes

#[Hook('entity_form_display_alter', module: 'layout_builder')]

File

core/modules/layout_builder/tests/modules/layout_builder_test/src/Hook/LayoutBuilderTestEntityHooks.php, line 56

Class

LayoutBuilderTestEntityHooks
Entity hook implementations for layout_builder_test.

Namespace

Drupal\layout_builder_test\Hook

Code

public function layoutBuilderEntityFormDisplayAlter(EntityFormDisplayInterface $form_display, array $context) : void {
  if ($context['form_mode'] === 'layout_builder') {
    $form_display->setComponent('status', [
      'type' => 'boolean_checkbox',
      'settings' => [
        'display_label' => TRUE,
      ],
    ]);
  }
}

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