public function EntityTranslationHandlerFactory::getHandlerId in Entity Translation 7
Retrieves the translation handler identifier for the given entity.
Parameters
$entity_type: The type of the entity the translation handler will wrap.
$entity: The entity the translation handler will wrap.
1 call to EntityTranslationHandlerFactory::getHandlerId()
- EntityTranslationHandlerFactory::getHandler in includes/
translation.handler_factory.inc - Translation handler factory.
File
- includes/
translation.handler_factory.inc, line 110 - Translation handler factory for the Entity Translation module.
Class
- EntityTranslationHandlerFactory
- Class implementing the entity translation handler factory.
Code
public function getHandlerId($entity_type, $entity) {
if (!isset($entity->entity_translation_handler_id)) {
list($id, $revision_id, $bundle) = entity_extract_ids($entity_type, $entity);
$revision_id = isset($revision_id) ? $revision_id : 0;
$bundle = isset($bundle) ? $bundle : $entity_type;
$entity->entity_translation_handler_id = $entity_type . '-' . $bundle . '-' . (!empty($id) ? 'eid-' . $id . '-' . $revision_id : 'new-' . self::$newId++);
}
return $entity->entity_translation_handler_id;
}