interface TranslatableInterface in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/TypedData/TranslatableInterface.php \Drupal\Core\TypedData\TranslatableInterface
Interface for translatable data.
Hierarchy
- interface \Drupal\Core\TypedData\TranslatableInterface
Expanded class hierarchy of TranslatableInterface
All classes that implement TranslatableInterface
8 files declare their use of TranslatableInterface
- BulkForm.php in core/
modules/ system/ src/ Plugin/ views/ field/ BulkForm.php - Contains \Drupal\system\Plugin\views\field\BulkForm.
- ContentEntityInterface.php in core/
lib/ Drupal/ Core/ Entity/ ContentEntityInterface.php - Contains \Drupal\Core\Entity\ContentEntityInterface.
- EntityConverter.php in core/
lib/ Drupal/ Core/ ParamConverter/ EntityConverter.php - Contains \Drupal\Core\ParamConverter\EntityConverter.
- EntityReferenceFormatterBase.php in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ EntityReferenceFormatterBase.php - Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase.
- EntityRepository.php in core/
lib/ Drupal/ Core/ Entity/ EntityRepository.php - Contains \Drupal\Core\Entity\EntityRepository.
File
- core/
lib/ Drupal/ Core/ TypedData/ TranslatableInterface.php, line 13 - Contains \Drupal\Core\TypedData\TranslatableInterface.
Namespace
Drupal\Core\TypedDataView source
interface TranslatableInterface {
/**
* Returns the translation language.
*
* @return \Drupal\Core\Language\LanguageInterface
* The language object.
*/
public function language();
/**
* Checks whether the translation is the default one.
*
* @return bool
* TRUE if the translation is the default one, FALSE otherwise.
*/
public function isDefaultTranslation();
/**
* Checks whether the translation is new.
*
* @return bool
* TRUE if the translation is new, FALSE otherwise.
*/
public function isNewTranslation();
/**
* Returns the languages the data is translated to.
*
* @param bool $include_default
* (optional) Whether the default language should be included. Defaults to
* TRUE.
*
* @return \Drupal\Core\Language\LanguageInterface[]
* An associative array of language objects, keyed by language codes.
*/
public function getTranslationLanguages($include_default = TRUE);
/**
* Gets a translation of the data.
*
* The returned translation has to be of the same type than this typed data
* object.
*
* @param $langcode
* The language code of the translation to get or
* LanguageInterface::LANGCODE_DEFAULT
* to get the data in default language.
*
* @return $this
* A typed data object for the translated data.
*
* @throws \InvalidArgumentException
* If an invalid or non-existing translation language is specified.
*/
public function getTranslation($langcode);
/**
* Returns the translatable object referring to the original language.
*
* @return $this
* The translation object referring to the original language.
*/
public function getUntranslated();
/**
* Returns TRUE there is a translation for the given language code.
*
* @param string $langcode
* The language code identifying the translation.
*
* @return bool
* TRUE if the translation exists, FALSE otherwise.
*/
public function hasTranslation($langcode);
/**
* Adds a new translation to the translatable object.
*
* @param string $langcode
* The language code identifying the translation.
* @param array $values
* (optional) An array of initial values to be assigned to the translatable
* fields. Defaults to none.
*
* @return $this
*
* @throws \InvalidArgumentException
* If an invalid or existing translation language is specified.
*/
public function addTranslation($langcode, array $values = array());
/**
* Removes the translation identified by the given language code.
*
* @param string $langcode
* The language code identifying the translation to be removed.
*/
public function removeTranslation($langcode);
/**
* Returns the translation support status.
*
* @return bool
* TRUE if the object has translation support enabled.
*/
public function isTranslatable();
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TranslatableInterface:: |
public | function | Adds a new translation to the translatable object. | 1 |
TranslatableInterface:: |
public | function | Gets a translation of the data. | 1 |
TranslatableInterface:: |
public | function | Returns the languages the data is translated to. | 1 |
TranslatableInterface:: |
public | function | Returns the translatable object referring to the original language. | 1 |
TranslatableInterface:: |
public | function | Returns TRUE there is a translation for the given language code. | 1 |
TranslatableInterface:: |
public | function | Checks whether the translation is the default one. | 1 |
TranslatableInterface:: |
public | function | Checks whether the translation is new. | 1 |
TranslatableInterface:: |
public | function | Returns the translation support status. | 1 |
TranslatableInterface:: |
public | function | Returns the translation language. | |
TranslatableInterface:: |
public | function | Removes the translation identified by the given language code. | 1 |