public function ModerationInformationInterface::getOriginalState in Drupal 8
Same name and namespace in other branches
- 9 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.
1 method overrides ModerationInformationInterface::getOriginalState()
- ModerationInformation::getOriginalState in core/
modules/ content_moderation/ src/ ModerationInformation.php - Gets the original or initial state of the given entity.
File
- core/
modules/ content_moderation/ src/ ModerationInformationInterface.php, line 237
Class
- ModerationInformationInterface
- Interface for moderation_information service.
Namespace
Drupal\content_moderationCode
public function getOriginalState(ContentEntityInterface $entity);