function ContentModerationHooks::entityFormDisplayAlter

Implements hook_entity_form_display_alter().

File

core/modules/content_moderation/src/Hook/ContentModerationHooks.php, line 193

Class

ContentModerationHooks
Hook implementations for content_moderation.

Namespace

Drupal\content_moderation\Hook

Code

public function entityFormDisplayAlter(EntityFormDisplayInterface $form_display, array $context) {
    if ($context['form_mode'] === 'layout_builder') {
        $form_display->setComponent('moderation_state', [
            'type' => 'moderation_state_default',
            'weight' => -900,
            'settings' => [],
        ]);
    }
}

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