TranslatableRevisionableStorageInterface.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Drupal\Core\Entity;
  3. /**
  4. * A storage that supports translatable and revisionable entity types.
  5. */
  6. interface TranslatableRevisionableStorageInterface extends TranslatableStorageInterface, RevisionableStorageInterface {
  7. /**
  8. * Creates a new revision starting off from the specified entity object.
  9. *
  10. * When dealing with a translatable entity, this will merge the default
  11. * revision with the active translation of the passed entity.
  12. *
  13. * @param \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface $entity
  14. * The revisionable entity object being modified.
  15. * @param bool $default
  16. * (optional) Whether the new revision should be marked as default. Defaults
  17. * to TRUE.
  18. * @param bool|null $keep_untranslatable_fields
  19. * (optional) Whether untranslatable field values should be kept or copied
  20. * from the default revision when generating a merged revision.
  21. *
  22. * @return \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface
  23. * A new translatable entity revision object.
  24. */
  25. public function createRevision(RevisionableInterface $entity, $default = TRUE, $keep_untranslatable_fields = NULL);
  26. /**
  27. * Returns the latest revision affecting the specified translation.
  28. *
  29. * @param int|string $entity_id
  30. * The entity identifier.
  31. * @param string $langcode
  32. * The language code of the translation.
  33. *
  34. * @return int|string|null
  35. * A revision ID or NULL if no revision affecting the specified translation
  36. * could be found.
  37. */
  38. public function getLatestTranslationAffectedRevisionId($entity_id, $langcode);
  39. }