diff --git a/core/modules/content_moderation/src/EntityTypeInfo.php b/core/modules/content_moderation/src/EntityTypeInfo.php index c1046aa..1e2497d 100644 --- a/core/modules/content_moderation/src/EntityTypeInfo.php +++ b/core/modules/content_moderation/src/EntityTypeInfo.php @@ -170,7 +170,7 @@ public function entityOperation(EntityInterface $entity) { $operations = []; $type = $entity->getEntityType(); - if ($this->moderationInfo->isModeratedBundle($entity->getEntityType(), $entity->bundle())) { + if ($this->moderationInfo->shouldModerateEntities($entity->getEntityType(), $entity->bundle())) { $operations['manage-moderation'] = [ 'title' => t('Manage moderation'), 'weight' => 27, @@ -289,7 +289,7 @@ public function entityBaseFieldInfo(EntityTypeInterface $entity_type) { } /** - * Adds the ModerationState constraint to bundles that are moderated. + * Adds ModerationState constraint to bundles whose entities are moderated. * * @param \Drupal\Core\Field\FieldDefinitionInterface[] $fields * The array of bundle field definitions. @@ -301,7 +301,7 @@ public function entityBaseFieldInfo(EntityTypeInterface $entity_type) { * @see hook_entity_bundle_field_info_alter(); */ public function entityBundleFieldInfoAlter(&$fields, EntityTypeInterface $entity_type, $bundle) { - if (!empty($fields['moderation_state']) && $this->moderationInfo->isModeratedBundle($entity_type, $bundle)) { + if (!empty($fields['moderation_state']) && $this->moderationInfo->shouldModerateEntities($entity_type, $bundle)) { $fields['moderation_state']->addConstraint('ModerationState', []); } } diff --git a/core/modules/content_moderation/src/ModerationInformation.php b/core/modules/content_moderation/src/ModerationInformation.php index 3bdfbfe..6a7b939 100644 --- a/core/modules/content_moderation/src/ModerationInformation.php +++ b/core/modules/content_moderation/src/ModerationInformation.php @@ -53,7 +53,7 @@ public function isModeratedEntity(EntityInterface $entity) { return FALSE; } - return $this->isModeratedBundle($entity->getEntityType(), $entity->bundle()); + return $this->shouldModerateEntities($entity->getEntityType(), $entity->bundle()); } /** @@ -75,7 +75,7 @@ public function loadBundleEntity($bundle_entity_type_id, $bundle_id) { /** * {@inheritdoc} */ - public function isModeratedBundle(EntityTypeInterface $entity_type, $bundle) { + public function shouldModerateEntities(EntityTypeInterface $entity_type, $bundle) { if ($bundle_entity = $this->loadBundleEntity($entity_type->getBundleEntityType(), $bundle)) { return $bundle_entity->getThirdPartySetting('content_moderation', 'enabled', FALSE); } diff --git a/core/modules/content_moderation/src/ModerationInformationInterface.php b/core/modules/content_moderation/src/ModerationInformationInterface.php index dd8a4ae..9c53605 100644 --- a/core/modules/content_moderation/src/ModerationInformationInterface.php +++ b/core/modules/content_moderation/src/ModerationInformationInterface.php @@ -48,7 +48,7 @@ public function isModeratedEntity(EntityInterface $entity); public function canModerateEntityType(EntityTypeInterface $entity_type); /** - * Determines if an entity type/bundle is moderated. + * Determines if an entity type/bundle entities should be moderated. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type definition to check. @@ -56,9 +56,10 @@ public function canModerateEntityType(EntityTypeInterface $entity_type); * The bundle to check. * * @return bool - * TRUE if this is a bundle is moderated, FALSE otherwise. + * TRUE if an entity type/bundle entities should be moderated, FALSE + * otherwise. */ - public function isModeratedBundle(EntityTypeInterface $entity_type, $bundle); + public function shouldModerateEntities(EntityTypeInterface $entity_type, $bundle); /** * Filters entity lists to just bundle definitions for revisionable entities. diff --git a/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php b/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php index 7b02851..30b0c7f 100644 --- a/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php +++ b/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php @@ -100,7 +100,7 @@ public function testIsModeratedEntityForNonBundleEntityType() { /** * @dataProvider providerBoolean - * @covers ::isModeratedBundle + * @covers ::shouldModerateEntities */ public function testIsModeratedBundle($status) { $entity_type = new ContentEntityType([ @@ -110,7 +110,7 @@ public function testIsModeratedBundle($status) { $moderation_information = new ModerationInformation($this->setupModerationEntityManager($status), $this->getUser()); - $this->assertEquals($status, $moderation_information->isModeratedBundle($entity_type, 'test_bundle')); + $this->assertEquals($status, $moderation_information->shouldModerateEntities($entity_type, 'test_bundle')); } /**