diff --git a/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php b/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php index 76f00e00afea8dac9e563bb704b033b3a2c024ac..53bb80afac864c98e6a611d00d3859a3559f6085 100644 --- a/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php +++ b/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php @@ -54,7 +54,7 @@ public function enforceRevisionsBundleFormAlter(array &$form, FormStateInterface /* @var \Drupal\node\Entity\NodeType $entity */ $entity = $form_state->getFormObject()->getEntity(); - if ($this->moderationInfo->getWorkFlowForEntity($entity)) { + if ($this->moderationInfo->getWorkflowForEntity($entity)) { // Force the revision checkbox on. $form['workflow']['options']['#default_value']['revision'] = 'revision'; $form['workflow']['options']['revision']['#disabled'] = TRUE; diff --git a/core/modules/content_moderation/src/EntityOperations.php b/core/modules/content_moderation/src/EntityOperations.php index b4d637ff94a10aa3c10076d650563ac29197ee60..af87f6fc329cc941bd69e9183761f5ffd39bdcac 100644 --- a/core/modules/content_moderation/src/EntityOperations.php +++ b/core/modules/content_moderation/src/EntityOperations.php @@ -101,7 +101,7 @@ public function entityPresave(EntityInterface $entity) { } if ($entity->moderation_state->value) { - $workflow = $this->moderationInfo->getWorkFlowForEntity($entity); + $workflow = $this->moderationInfo->getWorkflowForEntity($entity); /** @var \Drupal\content_moderation\ContentModerationState $current_state */ $current_state = $workflow->getState($entity->moderation_state->value); @@ -154,7 +154,7 @@ public function entityUpdate(EntityInterface $entity) { */ protected function updateOrCreateFromEntity(EntityInterface $entity) { $moderation_state = $entity->moderation_state->value; - $workflow = $this->moderationInfo->getWorkFlowForEntity($entity); + $workflow = $this->moderationInfo->getWorkflowForEntity($entity); /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ if (!$moderation_state) { $moderation_state = $workflow->getInitialState()->id(); diff --git a/core/modules/content_moderation/src/Form/EntityModerationForm.php b/core/modules/content_moderation/src/Form/EntityModerationForm.php index 6b13ff7083993e8eb6e8c4373e451542bcda3cd3..6e4daea0a6cfd8a07e2c3afa89dca920eb898c5b 100644 --- a/core/modules/content_moderation/src/Form/EntityModerationForm.php +++ b/core/modules/content_moderation/src/Form/EntityModerationForm.php @@ -64,7 +64,7 @@ public function getFormId() { */ public function buildForm(array $form, FormStateInterface $form_state, ContentEntityInterface $entity = NULL) { $current_state = $entity->moderation_state->value; - $workflow = $this->moderationInfo->getWorkFlowForEntity($entity); + $workflow = $this->moderationInfo->getWorkflowForEntity($entity); /** @var \Drupal\workflows\Transition[] $transitions */ $transitions = $this->validation->getValidTransitions($entity, $this->currentUser()); @@ -133,7 +133,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { drupal_set_message($this->t('The moderation state has been updated.')); - $new_state = $this->moderationInfo->getWorkFlowForEntity($entity)->getState($new_state); + $new_state = $this->moderationInfo->getWorkflowForEntity($entity)->getState($new_state); // The page we're on likely won't be visible if we just set the entity to // the default state, as we hide that latest-revision tab if there is no // forward revision. Redirect to the canonical URL instead, since that will diff --git a/core/modules/content_moderation/src/ModerationInformation.php b/core/modules/content_moderation/src/ModerationInformation.php index e8ebf39ebef3f4fe8587edb55ee072fff18102ab..c20be5291f2d1bdc41d2e683244337c2b12c3fb8 100644 --- a/core/modules/content_moderation/src/ModerationInformation.php +++ b/core/modules/content_moderation/src/ModerationInformation.php @@ -130,7 +130,7 @@ public function hasForwardRevision(ContentEntityInterface $entity) { * {@inheritdoc} */ public function isLiveRevision(ContentEntityInterface $entity) { - $workflow = $this->getWorkFlowForEntity($entity); + $workflow = $this->getWorkflowForEntity($entity); return $this->isLatestRevision($entity) && $entity->isDefaultRevision() && $entity->moderation_state->value @@ -140,7 +140,7 @@ public function isLiveRevision(ContentEntityInterface $entity) { /** * {@inheritdoc} */ - public function getWorkFlowForEntity(ContentEntityInterface $entity) { + public function getWorkflowForEntity(ContentEntityInterface $entity) { $bundles = $this->bundleInfo->getBundleInfo($entity->getEntityTypeId()); if (isset($bundles[$entity->bundle()]['workflow'])) { return $this->entityTypeManager->getStorage('workflow')->load($bundles[$entity->bundle()]['workflow']); diff --git a/core/modules/content_moderation/src/ModerationInformationInterface.php b/core/modules/content_moderation/src/ModerationInformationInterface.php index 531057ecdb7f3d8b61fe6e0272cd5c7f15eecdf6..862987f8d8c5c3c89621bc1fef5aeed182b9f3eb 100644 --- a/core/modules/content_moderation/src/ModerationInformationInterface.php +++ b/core/modules/content_moderation/src/ModerationInformationInterface.php @@ -135,6 +135,6 @@ public function isLiveRevision(ContentEntityInterface $entity); * @return \Drupal\workflows\WorkflowInterface|null * The workflow entity. NULL if there is no workflow. */ - public function getWorkFlowForEntity(ContentEntityInterface $entity); + public function getWorkflowForEntity(ContentEntityInterface $entity); } diff --git a/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php index 8c17d8281725dc651346bd79483105ce87ae23be..7fe5a6db9a56aba20c4495148cfdca577c04e5b4 100644 --- a/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php +++ b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php @@ -116,7 +116,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen return $element + ['#access' => FALSE]; } - $workflow = $this->moderationInformation->getWorkFlowForEntity($entity); + $workflow = $this->moderationInformation->getWorkflowForEntity($entity); $default = $items->get($delta)->value ? $workflow->getState($items->get($delta)->value) : $workflow->getInitialState(); if (!$default) { throw new \UnexpectedValueException(sprintf('The %s bundle has an invalid moderation state configuration, moderation states are enabled but no default is set.', $bundle_entity->label())); diff --git a/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php index fd31d3345c28fd05e5f15b2cedea46a8b9a00e70..0444644f93266c56524ff534fac1e144b42971b8 100644 --- a/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php +++ b/core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php @@ -37,7 +37,7 @@ protected function getModerationStateId() { // It is possible that the bundle does not exist at this point. For example, // the node type form creates a fake Node entity to get default values. // @see \Drupal\node\NodeTypeForm::form() - $workflow = $moderation_info->getWorkFlowForEntity($entity); + $workflow = $moderation_info->getWorkflowForEntity($entity); return $workflow ? $workflow->getInitialState()->id() : NULL; } @@ -60,7 +60,7 @@ protected function loadContentModerationStateRevision(ContentEntityInterface $en // Ensure the correct revision is loaded in scenarios where a revision is // being reverted. ->condition('content_entity_revision_id', $entity->isNewRevision() ? $entity->getLoadedRevisionId() : $entity->getRevisionId()) - ->condition('workflow', $moderation_info->getWorkFlowForEntity($entity)->id()) + ->condition('workflow', $moderation_info->getWorkflowForEntity($entity)->id()) ->allRevisions() ->sort('revision_id', 'DESC') ->execute(); diff --git a/core/modules/content_moderation/src/Plugin/Validation/Constraint/ModerationStateConstraintValidator.php b/core/modules/content_moderation/src/Plugin/Validation/Constraint/ModerationStateConstraintValidator.php index d90e19e7477c7ccb705edde52cb70e5eb408c167..d9308e8a11495cc9d021f3ad358e5b768d43d144 100644 --- a/core/modules/content_moderation/src/Plugin/Validation/Constraint/ModerationStateConstraintValidator.php +++ b/core/modules/content_moderation/src/Plugin/Validation/Constraint/ModerationStateConstraintValidator.php @@ -92,7 +92,7 @@ public function validate($value, Constraint $constraint) { $original_entity = $original_entity->getTranslation($entity->language()->getId()); } - $workflow = $this->moderationInformation->getWorkFlowForEntity($entity); + $workflow = $this->moderationInformation->getWorkflowForEntity($entity); $new_state = $workflow->getState($entity->moderation_state->value) ?: $workflow->getInitialState(); $original_state = $workflow->getState($original_entity->moderation_state->value); // @todo - what if $new_state references something that does not exist or diff --git a/core/modules/content_moderation/src/StateTransitionValidation.php b/core/modules/content_moderation/src/StateTransitionValidation.php index e3d337639772833c5b40c3a3d95cdf8cbb8620d3..c4e26c26ff9bd00126c1bc93203d367cf052af7d 100644 --- a/core/modules/content_moderation/src/StateTransitionValidation.php +++ b/core/modules/content_moderation/src/StateTransitionValidation.php @@ -39,7 +39,7 @@ public function __construct(ModerationInformationInterface $moderation_info) { * {@inheritdoc} */ public function getValidTransitions(ContentEntityInterface $entity, AccountInterface $user) { - $workflow = $this->moderationInfo->getWorkFlowForEntity($entity); + $workflow = $this->moderationInfo->getWorkflowForEntity($entity); $current_state = $entity->moderation_state->value ? $workflow->getState($entity->moderation_state->value) : $workflow->getInitialState(); return array_filter($current_state->getTransitions(), function(Transition $transition) use ($workflow, $user) { diff --git a/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php b/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php index d7a737302b339054cc9ed44bb6d3fffb72927632..8d319ef319a8a06111da51caf549a30ee0b0ab04 100644 --- a/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php +++ b/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php @@ -82,9 +82,9 @@ public function testIsModeratedEntity($workflow, $expected) { /** * @dataProvider providerWorkflow - * @covers ::getWorkFlowForEntity + * @covers ::getWorkflowForEntity */ - public function testGetWorkFlowForEntity($workflow) { + public function testGetWorkflowForEntity($workflow) { $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class); if ($workflow) { $workflow_entity = $this->prophesize(WorkflowInterface::class)->reveal(); @@ -100,7 +100,7 @@ public function testGetWorkFlowForEntity($workflow) { $entity->getEntityTypeId()->willReturn('test_entity_type'); $entity->bundle()->willReturn('test_bundle'); - $this->assertEquals($workflow_entity, $moderation_information->getWorkFlowForEntity($entity->reveal())); + $this->assertEquals($workflow_entity, $moderation_information->getWorkflowForEntity($entity->reveal())); } /** diff --git a/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php b/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php index e518aedeab1fdd51d250cf975076c5999c90114e..2e034477878e81e3377636193f037cdd65b8ba7e 100644 --- a/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php +++ b/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php @@ -78,7 +78,7 @@ protected function setUpModerationInformation(ContentEntityInterface $entity) { ->addTransition('review', 'review', ['draft'], 'needs_review') ->addTransition('publish', 'publish', ['needs_review', 'published'], 'published'); $moderation_info = $this->prophesize(ModerationInformationInterface::class); - $moderation_info->getWorkFlowForEntity($entity)->willReturn($workflow); + $moderation_info->getWorkflowForEntity($entity)->willReturn($workflow); return $moderation_info->reveal(); }