TranslatableRevisionableStorageInterface.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. Defaults to
  21. * TRUE if the provided entity is the default translation and untranslatable
  22. * fields should only affect the default translation, FALSE otherwise.
  23. *
  24. * @return \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface
  25. * A new translatable entity revision object.
  26. */
  27. public function createRevision(RevisionableInterface $entity, $default = TRUE, $keep_untranslatable_fields = NULL);
  28. /**
  29. * Returns the latest revision affecting the specified translation.
  30. *
  31. * @param int|string $entity_id
  32. * The entity identifier.
  33. * @param string $langcode
  34. * The language code of the translation.
  35. *
  36. * @return int|string|null
  37. * A revision ID or NULL if no revision affecting the specified translation
  38. * could be found.
  39. */
  40. public function getLatestTranslationAffectedRevisionId($entity_id, $langcode);
  41. }