function EntityTypeInfo::isModeratedEntityEditForm

Same name in other branches
  1. 9 core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::isModeratedEntityEditForm()
  2. 8.9.x core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::isModeratedEntityEditForm()
  3. 11.x core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::isModeratedEntityEditForm()

Checks whether the specified form allows to edit a moderated entity.

Parameters

\Drupal\Core\Form\FormInterface $form_object: The form object.

Return value

bool TRUE if the form should get form moderation, FALSE otherwise.

2 calls to EntityTypeInfo::isModeratedEntityEditForm()
EntityTypeInfo::entityPrepareForm in core/modules/content_moderation/src/EntityTypeInfo.php
Replaces the entity form entity object with a proper revision object.
EntityTypeInfo::formAlter in core/modules/content_moderation/src/EntityTypeInfo.php
Alters bundle forms to enforce revision handling.

File

core/modules/content_moderation/src/EntityTypeInfo.php, line 381

Class

EntityTypeInfo
Manipulates entity type information.

Namespace

Drupal\content_moderation

Code

protected function isModeratedEntityEditForm(FormInterface $form_object) {
    return $form_object instanceof ContentEntityFormInterface && in_array($form_object->getOperation(), [
        'edit',
        'default',
        'layout_builder',
    ], TRUE) && $this->moderationInfo
        ->isModeratedEntity($form_object->getEntity());
}

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