3 namespace Drupal\content_translation;
5 use Drupal\Core\Entity\EntityInterface;
8 * Provides an interface for common functionality for content translation.
10 interface ContentTranslationManagerInterface {
13 * Gets the entity types that support content translation.
15 * @return \Drupal\Core\Entity\EntityTypeInterface[]
16 * An array of entity types that support content translation.
18 public function getSupportedEntityTypes();
21 * Checks whether an entity type supports translation.
23 * @param string $entity_type_id
27 * TRUE if an entity type is supported, FALSE otherwise.
29 public function isSupported($entity_type_id);
32 * Returns an instance of the Content translation handler.
34 * @param string $entity_type_id
35 * The type of the entity being translated.
37 * @return \Drupal\content_translation\ContentTranslationHandlerInterface
38 * An instance of the content translation handler.
40 public function getTranslationHandler($entity_type_id);
43 * Returns an instance of the Content translation metadata.
45 * @param \Drupal\Core\Entity\EntityInterface $translation
46 * The entity translation whose metadata needs to be retrieved.
48 * @return \Drupal\content_translation\ContentTranslationMetadataWrapperInterface
49 * An instance of the content translation metadata.
51 public function getTranslationMetadata(EntityInterface $translation);
54 * Sets the value for translatability of the given entity type bundle.
56 * @param string $entity_type_id
58 * @param string $bundle
59 * The bundle of the entity.
61 * The boolean value we need to save.
63 public function setEnabled($entity_type_id, $bundle, $value);
66 * Determines whether the given entity type is translatable.
68 * @param string $entity_type_id
69 * The type of the entity.
70 * @param string $bundle
71 * (optional) The bundle of the entity. If no bundle is provided, all the
72 * available bundles are checked.
75 * TRUE if the specified bundle is translatable. If no bundle is provided
76 * returns TRUE if at least one of the entity bundles is translatable.
78 public function isEnabled($entity_type_id, $bundle = NULL);