Loading core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php +4 −3 Changes for core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php: 4 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -100,9 +100,10 @@ protected function hasUntranslatableFieldsChanges(ContentEntityInterface $entity $original = $entity->original; } else { $original = $this->entityTypeManager ->getStorage($entity->getEntityTypeId()) ->loadRevision($entity->getLoadedRevisionId()); /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager ->getStorage($entity->getEntityTypeId()); $original = $storage->loadRevision($entity->getLoadedRevisionId()); } foreach ($entity->getFieldDefinitions() as $field_name => $definition) { Loading core/lib/Drupal/Core/ParamConverter/EntityRevisionParamConverter.php +3 −1 Changes for core/lib/Drupal/Core/ParamConverter/EntityRevisionParamConverter.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -61,7 +61,9 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Ent */ public function convert($value, $definition, $name, array $defaults) { $entity_type_id = $this->getEntityTypeFromDefaults($definition, $name, $defaults); $entity = $this->entityTypeManager->getStorage($entity_type_id)->loadRevision($value); /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity_type_id); $entity = $storage->loadRevision($value); // If the entity type is translatable, ensure we return the proper // translation object for the current context. Loading core/modules/content_moderation/src/Entity/ContentModerationState.php +4 −2 Changes for core/modules/content_moderation/src/Entity/ContentModerationState.php: 4 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -161,8 +161,10 @@ public static function loadFromModeratedEntity(EntityInterface $entity) { * {@inheritdoc} */ public function save() { $related_entity = \Drupal::entityTypeManager() ->getStorage($this->content_entity_type_id->value) /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager() ->getStorage($this->content_entity_type_id->value); $related_entity = $storage ->loadRevision($this->content_entity_revision_id->value); if ($related_entity instanceof TranslatableInterface) { $related_entity = $related_entity->getTranslation($this->activeLangcode); Loading core/modules/content_moderation/src/ModerationInformation.php +5 −2 Changes for core/modules/content_moderation/src/ModerationInformation.php: 5 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ public function getAffectedRevisionTranslation(ContentEntityInterface $entity) { public function hasPendingRevision(ContentEntityInterface $entity) { $result = FALSE; if ($this->isModeratedEntity($entity)) { /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */ /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); $latest_revision_id = $storage->getLatestTranslationAffectedRevisionId($entity->id(), $entity->language()->getId()); $default_revision_id = $entity->isDefaultRevision() && !$entity->isNewRevision() && ($revision_id = $entity->getRevisionId()) ? Loading Loading @@ -215,8 +215,10 @@ public function getOriginalState(ContentEntityInterface $entity) { $state = NULL; $workflow_type = $this->getWorkflowForEntity($entity)->getTypePlugin(); if (!$entity->isNew() && !$this->isFirstTimeModeration($entity)) { /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); /** @var \Drupal\Core\Entity\ContentEntityInterface $original_entity */ $original_entity = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadRevision($entity->getLoadedRevisionId()); $original_entity = $storage->loadRevision($entity->getLoadedRevisionId()); if (!$entity->isDefaultTranslation() && $original_entity->hasTranslation($entity->language()->getId())) { $original_entity = $original_entity->getTranslation($entity->language()->getId()); } Loading @@ -240,6 +242,7 @@ public function getOriginalState(ContentEntityInterface $entity) { * TRUE if this is the entity's first time being moderated, FALSE otherwise. */ protected function isFirstTimeModeration(ContentEntityInterface $entity) { /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); $original_entity = $storage->loadRevision($storage->getLatestRevisionId($entity->id())); Loading core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php +3 −1 Changes for core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -125,8 +125,10 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen // The moderation state of the saved revision will be used to display the // current state as well determine the appropriate transitions. if (!$entity->isNew()) { /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); /** @var \Drupal\Core\Entity\ContentEntityInterface $original_entity */ $original_entity = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadRevision($entity->getLoadedRevisionId()); $original_entity = $storage->loadRevision($entity->getLoadedRevisionId()); if (!$entity->isDefaultTranslation() && $original_entity->hasTranslation($entity->language()->getId())) { $original_entity = $original_entity->getTranslation($entity->language()->getId()); } Loading Loading
core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php +4 −3 Changes for core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php: 4 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -100,9 +100,10 @@ protected function hasUntranslatableFieldsChanges(ContentEntityInterface $entity $original = $entity->original; } else { $original = $this->entityTypeManager ->getStorage($entity->getEntityTypeId()) ->loadRevision($entity->getLoadedRevisionId()); /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager ->getStorage($entity->getEntityTypeId()); $original = $storage->loadRevision($entity->getLoadedRevisionId()); } foreach ($entity->getFieldDefinitions() as $field_name => $definition) { Loading
core/lib/Drupal/Core/ParamConverter/EntityRevisionParamConverter.php +3 −1 Changes for core/lib/Drupal/Core/ParamConverter/EntityRevisionParamConverter.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -61,7 +61,9 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Ent */ public function convert($value, $definition, $name, array $defaults) { $entity_type_id = $this->getEntityTypeFromDefaults($definition, $name, $defaults); $entity = $this->entityTypeManager->getStorage($entity_type_id)->loadRevision($value); /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity_type_id); $entity = $storage->loadRevision($value); // If the entity type is translatable, ensure we return the proper // translation object for the current context. Loading
core/modules/content_moderation/src/Entity/ContentModerationState.php +4 −2 Changes for core/modules/content_moderation/src/Entity/ContentModerationState.php: 4 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -161,8 +161,10 @@ public static function loadFromModeratedEntity(EntityInterface $entity) { * {@inheritdoc} */ public function save() { $related_entity = \Drupal::entityTypeManager() ->getStorage($this->content_entity_type_id->value) /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager() ->getStorage($this->content_entity_type_id->value); $related_entity = $storage ->loadRevision($this->content_entity_revision_id->value); if ($related_entity instanceof TranslatableInterface) { $related_entity = $related_entity->getTranslation($this->activeLangcode); Loading
core/modules/content_moderation/src/ModerationInformation.php +5 −2 Changes for core/modules/content_moderation/src/ModerationInformation.php: 5 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ public function getAffectedRevisionTranslation(ContentEntityInterface $entity) { public function hasPendingRevision(ContentEntityInterface $entity) { $result = FALSE; if ($this->isModeratedEntity($entity)) { /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */ /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); $latest_revision_id = $storage->getLatestTranslationAffectedRevisionId($entity->id(), $entity->language()->getId()); $default_revision_id = $entity->isDefaultRevision() && !$entity->isNewRevision() && ($revision_id = $entity->getRevisionId()) ? Loading Loading @@ -215,8 +215,10 @@ public function getOriginalState(ContentEntityInterface $entity) { $state = NULL; $workflow_type = $this->getWorkflowForEntity($entity)->getTypePlugin(); if (!$entity->isNew() && !$this->isFirstTimeModeration($entity)) { /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); /** @var \Drupal\Core\Entity\ContentEntityInterface $original_entity */ $original_entity = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadRevision($entity->getLoadedRevisionId()); $original_entity = $storage->loadRevision($entity->getLoadedRevisionId()); if (!$entity->isDefaultTranslation() && $original_entity->hasTranslation($entity->language()->getId())) { $original_entity = $original_entity->getTranslation($entity->language()->getId()); } Loading @@ -240,6 +242,7 @@ public function getOriginalState(ContentEntityInterface $entity) { * TRUE if this is the entity's first time being moderated, FALSE otherwise. */ protected function isFirstTimeModeration(ContentEntityInterface $entity) { /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); $original_entity = $storage->loadRevision($storage->getLatestRevisionId($entity->id())); Loading
core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php +3 −1 Changes for core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -125,8 +125,10 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen // The moderation state of the saved revision will be used to display the // current state as well determine the appropriate transitions. if (!$entity->isNew()) { /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); /** @var \Drupal\Core\Entity\ContentEntityInterface $original_entity */ $original_entity = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadRevision($entity->getLoadedRevisionId()); $original_entity = $storage->loadRevision($entity->getLoadedRevisionId()); if (!$entity->isDefaultTranslation() && $original_entity->hasTranslation($entity->language()->getId())) { $original_entity = $original_entity->getTranslation($entity->language()->getId()); } Loading