You are here

interface EntityTranslationHandlerInterface in Entity Translation 7

Interface for enabling entity translation.

Defines a set of methods to allow any entity to be processed by the entity translation UI.

Hierarchy

Expanded class hierarchy of EntityTranslationHandlerInterface

All classes that implement EntityTranslationHandlerInterface

File

includes/translation.handler.inc, line 15
Default translation handler for the translation module.

View source
interface EntityTranslationHandlerInterface {

  /**
   * Injects the translation handler factory.
   */
  public function setFactory(EntityTranslationHandlerFactory $factory);

  /**
   * Registers a child translation handler for the given entity.
   */
  public function addChild($entity_type, $entity);

  /**
   * Removes a previously registered child translation handler.
   */
  public function removeChild($entity_type, $entity);

  /**
   * Loads the translation data into the wrapped entity.
   */
  public function loadTranslations();

  /**
   * Writes the translation status to the storage.
   */
  public function saveTranslations();

  /**
   * Returns the translation data for the current (wrapped) entity.
   */
  public function getTranslations();

  /**
   * Adds/updates an entity translation.
   *
   * @param $translation
   *   A translation array as defined by the translation table's schema.
   * @param $values
   *   (optional) the values that should be assigned to the field translations.
   */
  public function setTranslation($translation, $values = NULL);

  /**
   * Removes a translation from the translation set.
   *
   * @param $langcode
   *   The language code of the translation to be removed.
   */
  public function removeTranslation($langcode);

  /**
   * Initializes the translation set by creating the original translation.
   */
  public function initTranslations();

  /**
   * Updates the translation set from the current entity status.
   */
  public function updateTranslations();

  /**
   * Removes all translations from the translation set.
   */
  public function removeTranslations();

  /**
   * Removes all translations from the current revision.
   */
  public function removeRevisionTranslations();

  /**
   * Initialize the language of the original field values.
   *
   * Ensure that the original translation language matches the language assigned
   * to the original field values.
   *
   * @return
   *   TRUE if any initialization was necessary, FALSE otherwise.
   */
  public function initOriginalTranslation();

  /**
   * Returns the entity language.
   */
  public function getLanguage();

  /**
   * Sets the active language.
   *
   * This is the language that determines which translation should be considered
   * "active" for the wrapped entity. The "Entity Translation" module uses this
   * information to implement the UI-based translation workflow. Other modules
   * can rely on it to implement their own entity translation-related logic.
   *
   * This will affect which language is returned by the core "entity_language()"
   * function.
   *
   * @param string $langcode
   *   The active language code.
   *
   * @see entity_language()
   * @see entity_translation_language()
   * @see ::getActiveLanguage()
   */
  public function setActiveLanguage($langcode);

  /**
   * Returns the active language.
   *
   * @return string
   *   The active language for the wrapped entity.
   *
   * @see ::setActiveLanguage()
   */
  public function getActiveLanguage();

  /**
   * Sets the active form language.
   *
   * @param string $langcode
   *   The active form language code.
   *
   * @deprecated in 7.x-1.0-beta6, will be removed before 7.x-1.0. Use
   *   ::setActiveLanguage() instead.
   *
   * @see ::setActiveLanguage()
   */
  public function setFormLanguage($langcode);

  /**
   * Retrieves the active form language.
   *
   * @return string
   *   The active form language code.
   *
   * @deprecated in 7.x-1.0-beta6, will be removed before 7.x-1.0. Use
   *   ::getActiveLanguage() instead.
   *
   * @see ::getActiveLanguage()
   */
  public function getFormLanguage();

  /**
   * Returns the translation object key for the wrapped entity type.
   */
  public function getLanguageKey();

  /**
   * Returns the default language for the wrapped entity type and bundle.
   */
  public function getDefaultLanguage();

  /**
   * Sets the language of the original translation.
   *
   * @param $langcode
   *   The language code of the original content values.
   */
  public function setOriginalLanguage($langcode);

  /**
   * Returns TRUE if the entity is currently being translated.
   *
   * @deprecated This is no longer used and will be removed before the first
   *   stable release.
   */
  public function isTranslating();

  /**
   * Notifies the translation handler that its entity is being translated.
   *
   * @param $translating
   *   A boolean value.
   *
   * @deprecated This is no longer used and will be removed before the first
   *   stable release.
   */
  public function setTranslating($translating);

  /**
   * Return TRUE if a new revision of the entity has just been created.
   */
  public function isRevision();

  /**
   * Return TRUE if the entity type supports revisions.
   */
  public function isRevisionable();

  /**
   * Replaces the wrapped entity.
   *
   * @param $entity
   *   The entity to be translated.
   */
  public function setEntity($entity);

  /**
   * Returns the wrapped entity.
   *
   * @param return
   *   The wrapped entity.
   */
  public function getEntity();

  /**
   * Returns the wrapped entity type.
   *
   * @param return
   *   The wrapped entity type.
   */
  public function getEntityType();

  /**
   * Checks that the wrapped entity matches the give entity
   *
   * @param $entity_type
   *   The type of the entity to be matched.
   * @param $entity
   *   The entity to be matched.
   */
  public function isWrappedEntity($entity_type, $entity);

  /**
   * Sets the translation update status.
   *
   * @param $outdated
   *   A boolean value.
   */
  public function setOutdated($outdated);

  /**
   * Returns the base path for the current entity.
   *
   * This path will be prepended to the URL of any administration page.
   *
   * @return
   *   A string to be used as a URL path prefix.
   */
  public function getBasePath();

  /**
   * Returns the path of the entity edit form.
   *
   * @param $langcode
   *   (optional) The language the edit form should be presented in.
   */
  public function getEditPath($langcode = NULL);

  /**
   * Returns the path of the translation overview page.
   */
  public function getTranslatePath();

  /**
   * Returns the path of the entity view page.
   */
  public function getViewPath();

  /**
   * Returns the active path scheme.
   */
  public function getPathScheme();

  /**
   * Changes the active path scheme.
   *
   * @param $scheme
   *   The new path scheme.
   */
  public function setPathScheme($scheme);

  /**
   * Initializes the most suited path scheme based on the given path.
   *
   * @param $path
   *   (optional) The path to match the defined path schemes against. Defaults
   *   to the current path.
   *
   * @return
   *   The matched path scheme key.
   */
  public function initPathScheme($path = NULL);

  /**
   * A string allowing the user to identify the entity.
   */
  public function getLabel();

  /**
   * Checks if the user can perform the given operation on the wrapped entity.
   *
   * @param $op
   *   The operation to be performed.
   *
   * @return
   *   TRUE if the user is allowed to perform the given operation, FALSE
   *   otherwise.
   */
  public function getAccess($op);

  /**
   * Checks if a user is allowed to edit the given translation.
   */
  public function getTranslationAccess($langcode);

  /**
   * Checks if a user is allowed to edit shared fields on the active form.
   */
  public function getSharedFieldsAccess();

  /**
   * Return TRUE if the entity supports URL aliasing.
   */
  public function isAliasEnabled();

  /**
   * Sets the source language for the translation being created.
   */
  public function setSourceLanguage($langcode);

  /**
   * Retrieves the source language for the translation being created.
   */
  public function getSourceLanguage();

  /**
   * Returns TRUE if a new entity is currently wrapped.
   */
  public function isNewEntity();

  /**
   * Returns TRUE whether we are displying an entity form.
   */
  public function isEntityForm();

  /**
   * Performs the needed alterations to the entity form.
   */
  public function entityForm(&$form, &$form_state);

  /**
   * Adds an language selection widget to the entity form.
   */
  public function entityFormLanguageWidget(&$form, &$form_state);

  /**
   * Performs submission tasks on the submitted entity language.
   */
  public function entityFormLanguageWidgetSubmit($form, &$form_state);

  /**
   * Handle shared form elements.
   */
  public function entityFormSharedElements(&$element);

  /**
   * Performs validation tasks on the submitted entity forms.
   */
  public function entityFormValidate($form, &$form_state);

  /**
   * Performs submission tasks on the submitted entity forms.
   */
  public function entityFormSubmit($form, &$form_state);

  /**
   * Alters the local tasks render array to populate the language tabs.
   */
  public function localTasksAlter(&$data, $router_item, $root_path);

}

Members

Namesort descending Modifiers Type Description Overrides
EntityTranslationHandlerInterface::addChild public function Registers a child translation handler for the given entity. 1
EntityTranslationHandlerInterface::entityForm public function Performs the needed alterations to the entity form. 1
EntityTranslationHandlerInterface::entityFormLanguageWidget public function Adds an language selection widget to the entity form. 1
EntityTranslationHandlerInterface::entityFormLanguageWidgetSubmit public function Performs submission tasks on the submitted entity language. 1
EntityTranslationHandlerInterface::entityFormSharedElements public function Handle shared form elements. 1
EntityTranslationHandlerInterface::entityFormSubmit public function Performs submission tasks on the submitted entity forms. 1
EntityTranslationHandlerInterface::entityFormValidate public function Performs validation tasks on the submitted entity forms. 1
EntityTranslationHandlerInterface::getAccess public function Checks if the user can perform the given operation on the wrapped entity. 1
EntityTranslationHandlerInterface::getActiveLanguage public function Returns the active language. 1
EntityTranslationHandlerInterface::getBasePath public function Returns the base path for the current entity. 1
EntityTranslationHandlerInterface::getDefaultLanguage public function Returns the default language for the wrapped entity type and bundle. 1
EntityTranslationHandlerInterface::getEditPath public function Returns the path of the entity edit form. 1
EntityTranslationHandlerInterface::getEntity public function Returns the wrapped entity. 1
EntityTranslationHandlerInterface::getEntityType public function Returns the wrapped entity type. 1
EntityTranslationHandlerInterface::getFormLanguage Deprecated public function Retrieves the active form language. 1
EntityTranslationHandlerInterface::getLabel public function A string allowing the user to identify the entity. 1
EntityTranslationHandlerInterface::getLanguage public function Returns the entity language. 1
EntityTranslationHandlerInterface::getLanguageKey public function Returns the translation object key for the wrapped entity type. 1
EntityTranslationHandlerInterface::getPathScheme public function Returns the active path scheme. 1
EntityTranslationHandlerInterface::getSharedFieldsAccess public function Checks if a user is allowed to edit shared fields on the active form. 1
EntityTranslationHandlerInterface::getSourceLanguage public function Retrieves the source language for the translation being created. 1
EntityTranslationHandlerInterface::getTranslatePath public function Returns the path of the translation overview page. 1
EntityTranslationHandlerInterface::getTranslationAccess public function Checks if a user is allowed to edit the given translation. 1
EntityTranslationHandlerInterface::getTranslations public function Returns the translation data for the current (wrapped) entity. 1
EntityTranslationHandlerInterface::getViewPath public function Returns the path of the entity view page. 1
EntityTranslationHandlerInterface::initOriginalTranslation public function Initialize the language of the original field values. 1
EntityTranslationHandlerInterface::initPathScheme public function Initializes the most suited path scheme based on the given path. 1
EntityTranslationHandlerInterface::initTranslations public function Initializes the translation set by creating the original translation. 1
EntityTranslationHandlerInterface::isAliasEnabled public function Return TRUE if the entity supports URL aliasing. 1
EntityTranslationHandlerInterface::isEntityForm public function Returns TRUE whether we are displying an entity form. 1
EntityTranslationHandlerInterface::isNewEntity public function Returns TRUE if a new entity is currently wrapped. 1
EntityTranslationHandlerInterface::isRevision public function Return TRUE if a new revision of the entity has just been created. 1
EntityTranslationHandlerInterface::isRevisionable public function Return TRUE if the entity type supports revisions. 1
EntityTranslationHandlerInterface::isTranslating Deprecated public function Returns TRUE if the entity is currently being translated. 1
EntityTranslationHandlerInterface::isWrappedEntity public function Checks that the wrapped entity matches the give entity 1
EntityTranslationHandlerInterface::loadTranslations public function Loads the translation data into the wrapped entity. 1
EntityTranslationHandlerInterface::localTasksAlter public function Alters the local tasks render array to populate the language tabs. 1
EntityTranslationHandlerInterface::removeChild public function Removes a previously registered child translation handler. 1
EntityTranslationHandlerInterface::removeRevisionTranslations public function Removes all translations from the current revision. 1
EntityTranslationHandlerInterface::removeTranslation public function Removes a translation from the translation set. 1
EntityTranslationHandlerInterface::removeTranslations public function Removes all translations from the translation set. 1
EntityTranslationHandlerInterface::saveTranslations public function Writes the translation status to the storage. 1
EntityTranslationHandlerInterface::setActiveLanguage public function Sets the active language. 1
EntityTranslationHandlerInterface::setEntity public function Replaces the wrapped entity. 1
EntityTranslationHandlerInterface::setFactory public function Injects the translation handler factory. 1
EntityTranslationHandlerInterface::setFormLanguage Deprecated public function Sets the active form language. 1
EntityTranslationHandlerInterface::setOriginalLanguage public function Sets the language of the original translation. 1
EntityTranslationHandlerInterface::setOutdated public function Sets the translation update status. 1
EntityTranslationHandlerInterface::setPathScheme public function Changes the active path scheme. 1
EntityTranslationHandlerInterface::setSourceLanguage public function Sets the source language for the translation being created. 1
EntityTranslationHandlerInterface::setTranslating Deprecated public function Notifies the translation handler that its entity is being translated. 1
EntityTranslationHandlerInterface::setTranslation public function Adds/updates an entity translation. 1
EntityTranslationHandlerInterface::updateTranslations public function Updates the translation set from the current entity status. 1