annotate core/modules/content_translation/src/ContentTranslationManagerInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\content_translation;
Chris@0 4
Chris@0 5 use Drupal\Core\Entity\EntityInterface;
Chris@0 6
Chris@0 7 /**
Chris@0 8 * Provides an interface for common functionality for content translation.
Chris@0 9 */
Chris@0 10 interface ContentTranslationManagerInterface {
Chris@0 11
Chris@0 12 /**
Chris@0 13 * Gets the entity types that support content translation.
Chris@0 14 *
Chris@0 15 * @return \Drupal\Core\Entity\EntityTypeInterface[]
Chris@0 16 * An array of entity types that support content translation.
Chris@0 17 */
Chris@0 18 public function getSupportedEntityTypes();
Chris@0 19
Chris@0 20 /**
Chris@0 21 * Checks whether an entity type supports translation.
Chris@0 22 *
Chris@0 23 * @param string $entity_type_id
Chris@0 24 * The entity type.
Chris@0 25 *
Chris@0 26 * @return bool
Chris@0 27 * TRUE if an entity type is supported, FALSE otherwise.
Chris@0 28 */
Chris@0 29 public function isSupported($entity_type_id);
Chris@0 30
Chris@0 31 /**
Chris@0 32 * Returns an instance of the Content translation handler.
Chris@0 33 *
Chris@0 34 * @param string $entity_type_id
Chris@0 35 * The type of the entity being translated.
Chris@0 36 *
Chris@0 37 * @return \Drupal\content_translation\ContentTranslationHandlerInterface
Chris@0 38 * An instance of the content translation handler.
Chris@0 39 */
Chris@0 40 public function getTranslationHandler($entity_type_id);
Chris@0 41
Chris@0 42 /**
Chris@0 43 * Returns an instance of the Content translation metadata.
Chris@0 44 *
Chris@0 45 * @param \Drupal\Core\Entity\EntityInterface $translation
Chris@0 46 * The entity translation whose metadata needs to be retrieved.
Chris@0 47 *
Chris@0 48 * @return \Drupal\content_translation\ContentTranslationMetadataWrapperInterface
Chris@0 49 * An instance of the content translation metadata.
Chris@0 50 */
Chris@0 51 public function getTranslationMetadata(EntityInterface $translation);
Chris@0 52
Chris@0 53 /**
Chris@0 54 * Sets the value for translatability of the given entity type bundle.
Chris@0 55 *
Chris@0 56 * @param string $entity_type_id
Chris@0 57 * The entity type.
Chris@0 58 * @param string $bundle
Chris@0 59 * The bundle of the entity.
Chris@0 60 * @param bool $value
Chris@0 61 * The boolean value we need to save.
Chris@0 62 */
Chris@0 63 public function setEnabled($entity_type_id, $bundle, $value);
Chris@0 64
Chris@0 65 /**
Chris@0 66 * Determines whether the given entity type is translatable.
Chris@0 67 *
Chris@0 68 * @param string $entity_type_id
Chris@0 69 * The type of the entity.
Chris@0 70 * @param string $bundle
Chris@0 71 * (optional) The bundle of the entity. If no bundle is provided, all the
Chris@0 72 * available bundles are checked.
Chris@0 73 *
Chris@0 74 * @returns bool
Chris@0 75 * TRUE if the specified bundle is translatable. If no bundle is provided
Chris@0 76 * returns TRUE if at least one of the entity bundles is translatable.
Chris@0 77 */
Chris@0 78 public function isEnabled($entity_type_id, $bundle = NULL);
Chris@0 79
Chris@0 80 }