array( 'entity_translation' => array( 'class' => 'EntityTranslationCustomEntityHandler', 'base path' => 'custom_entity/%custom_entity', 'access callback' => 'custom_entity_tab_access', 'access arguments' => array(1), 'edit form' => 'custom_entity_form_state_key', 'bundle callback' => 'custom_entity_translation_enabled_bundle', 'default settings' => array( 'default_language' => LANGUAGE_NONE, 'hide_language_selector' => FALSE, ), ), ), ); // Entity type which has multiple (e.g. bundle-specific) paths. $info['custom_entity_2'] = array( 'translation' => array( 'entity_translation' => array( 'class' => 'EntityTranslationCustomEntityHandler', 'path schemes' => array( 'default' => array( 'base path' => 'custom_entity_2/%custom_entity', 'path wildcard' => '%custom_entity', ), 'fancy' => array( // Base path is not required. 'edit path' => 'fancy/%entity/edit', 'path wildcard' => '%entity', ), ), ) ) ); return $info; } /** * Allows modules to act when a new translation is added. * * @param $entity_type * The entity type. * @param $entity * The entity. * @param $translation * The inserted translation array. * @param $values * The translated set of values, if any. */ function hook_entity_translation_insert($entity_type, $entity, $translation, $values = array()) { } /** * Allows modules to act when a translation is updated. * * @param $entity_type * The entity type. * @param $entity * The entity. * @param $translation * The updated translation array. * @param $values * The translated set of values, if any. */ function hook_entity_translation_update($entity_type, $entity, $translation, $values = array()) { } /** * Allows modules to act when a translation is deleted. * * @param $entity_type * The entity type. * @param $entity * The entity. * @param $langcode * The langcode of the translation which was deleted. */ function hook_entity_translation_delete($entity_type, $entity, $langcode) { } /** * Allows modules to act when a revision translation is deleted. * * @param $entity_type * The entity type. * @param $entity * The entity. * @param $langcode * The langcode of the revision translation which was deleted. */ function hook_entity_translation_delete_revision($entity_type, $entity, $langcode) { } /** * Allows to sets the right values in the form state when adding a translation. */ function hook_entity_translation_source_field_state_alter(&$field_state) { if (isset($field_state['entity'])) { module_load_include('inc', 'entity', 'includes/entity.ui'); foreach ($field_state['entity'] as $delta => $entity) { if ($entity instanceof FieldCollectionItemEntity) { $field_state['entity'][$delta] = entity_ui_clone_entity('field_collection_item', $entity); } } } }