You are here

function entity_translation_get_handler in Entity Translation 7

Translation handler factory.

Parameters

$entity_type: (optional) The type of $entity; e.g. 'node' or 'user'.

$entity: (optional) The entity to be translated. A bundle name may be passed to instantiate an empty entity.

Return value

EntityTranslationHandlerInterface A class implementing EntityTranslationHandlerInterface.

40 calls to entity_translation_get_handler()
EntityTranslationHookTestCase::testAPI in tests/entity_translation.test
Test whether hooks are properly fired when using the API.
EntityTranslationTaxonomyAutocompleteTestCase::testTranslatedAutocomplete in tests/entity_translation.test
That the autocomplete works with translated terms.
entity_translation_add_access in ./entity_translation.module
Access callback.
entity_translation_add_page in ./entity_translation.module
Page callback.
entity_translation_delete_confirm in ./entity_translation.admin.inc
Translation deletion confirmation form.

... See full list

File

./entity_translation.module, line 1895

Code

function entity_translation_get_handler($entity_type = NULL, $entity = NULL) {
  $factory = EntityTranslationHandlerFactory::getInstance();
  return empty($entity) ? $factory
    ->getLastHandler($entity_type) : $factory
    ->getHandler($entity_type, $entity);
}