TranslatableStorageInterface.php 1.0 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Drupal\Core\Entity;
  3. /**
  4. * A storage that supports translatable entity types.
  5. */
  6. interface TranslatableStorageInterface {
  7. /**
  8. * Constructs a new entity translation object, without permanently saving it.
  9. *
  10. * @param \Drupal\Core\Entity\ContentEntityInterface $entity
  11. * The entity object being translated.
  12. * @param string $langcode
  13. * The translation language code.
  14. * @param array $values
  15. * (optional) An associative array of initial field values keyed by field
  16. * name. If none is provided default values will be applied.
  17. *
  18. * @return \Drupal\Core\Entity\ContentEntityInterface
  19. * Another instance of the specified entity object class with the specified
  20. * active language and initial values.
  21. *
  22. * @todo Consider accepting \Drupal\Core\Entity\TranslatableInterface as first
  23. * parameter. See https://www.drupal.org/project/drupal/issues/2932049.
  24. */
  25. public function createTranslation(ContentEntityInterface $entity, $langcode, array $values = []);
  26. }