TranslatableRevisionableStorageInterface.php 1.78 KB
Newer Older
1 2 3 4 5 6 7 8
<?php

namespace Drupal\Core\Entity;

/**
 * A storage that supports translatable and revisionable entity types.
 */
interface TranslatableRevisionableStorageInterface extends TranslatableStorageInterface, RevisionableStorageInterface {
9

10 11 12 13 14 15 16 17 18 19 20 21 22
  /**
   * Creates a new revision starting off from the specified entity object.
   *
   * When dealing with a translatable entity, this will merge the default
   * revision with the active translation of the passed entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface $entity
   *   The revisionable entity object being modified.
   * @param bool $default
   *   (optional) Whether the new revision should be marked as default. Defaults
   *   to TRUE.
   * @param bool|null $keep_untranslatable_fields
   *   (optional) Whether untranslatable field values should be kept or copied
23 24 25
   *   from the default revision when generating a merged revision. Defaults to
   *   TRUE if the provided entity is the default translation and untranslatable
   *   fields should only affect the default translation, FALSE otherwise.
26 27 28 29 30 31
   *
   * @return \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface
   *   A new translatable entity revision object.
   */
  public function createRevision(RevisionableInterface $entity, $default = TRUE, $keep_untranslatable_fields = NULL);

32 33 34 35 36 37 38 39 40 41 42 43 44 45
  /**
   * Returns the latest revision affecting the specified translation.
   *
   * @param int|string $entity_id
   *   The entity identifier.
   * @param string $langcode
   *   The language code of the translation.
   *
   * @return int|string|null
   *   A revision ID or NULL if no revision affecting the specified translation
   *   could be found.
   */
  public function getLatestTranslationAffectedRevisionId($entity_id, $langcode);

46
}