function ModerationInformationInterface::getOriginalState

Same name in other branches
  1. 9 core/modules/content_moderation/src/ModerationInformationInterface.php \Drupal\content_moderation\ModerationInformationInterface::getOriginalState()
  2. 8.9.x core/modules/content_moderation/src/ModerationInformationInterface.php \Drupal\content_moderation\ModerationInformationInterface::getOriginalState()
  3. 10 core/modules/content_moderation/src/ModerationInformationInterface.php \Drupal\content_moderation\ModerationInformationInterface::getOriginalState()

Gets the original or initial state of the given entity.

When a state is being validated, the original state is used to validate that a valid transition exists for target state and the user has access to the transition between those two states. If the entity has been moderated before, we can load the original unmodified revision and translation for this state.

If the entity is new we need to load the initial state from the workflow. Even if a value was assigned to the moderation_state field, the initial state is used to compute an appropriate transition for the purposes of validation.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The content entity to get the workflow for.

Return value

\Drupal\content_moderation\ContentModerationState The original or default moderation state.

File

core/modules/content_moderation/src/ModerationInformationInterface.php, line 181

Class

ModerationInformationInterface
Interface for moderation_information service.

Namespace

Drupal\content_moderation

Code

public function getOriginalState(ContentEntityInterface $entity);

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