updated entity_translation to last dev version

This commit is contained in:
Bachir Soussi Chiadmi
2015-10-14 17:09:13 +02:00
parent 81371521c7
commit d5628cc78e
14 changed files with 139 additions and 31 deletions

View File

@@ -441,10 +441,7 @@ class EntityTranslationDefaultHandler implements EntityTranslationHandlerInterfa
$query->condition('revision_id', $revisions_ids, 'IN');
}
$results = $query
->orderBy('entity_id')
->orderBy('created')
->execute();
$results = $query->execute();
foreach ($results as $row) {
$id = $row->entity_id;

View File

@@ -92,7 +92,9 @@ class EntityTranslationNodeHandler extends EntityTranslationDefaultHandler {
if (!$this->isTranslationForm()) {
// Inherit entity authoring information for the original values.
$values['name'] = $form_state['values']['name'];
if (isset($form_state['values']['name'])) {
$values['name'] = $form_state['values']['name'];
}
if (!empty($form_state['values']['date'])) {
$values['created'] = $form_state['values']['date'];
}

View File

@@ -15,6 +15,22 @@ class EntityTranslationTaxonomyTermHandler extends EntityTranslationDefaultHandl
parent::__construct('taxonomy_term', $entity_info, $entity);
}
/**
* @see EntityTranslationDefaultHandler::getLanguage()
*/
public function getLanguage() {
if (isset($this->entity->vid) && module_exists('i18n_taxonomy')) {
$mode = i18n_taxonomy_vocabulary_mode($this->entity->vid);
if ($mode == I18N_MODE_NONE) {
$translations = $this->getTranslations();
if (!empty($translations->original)) {
return $translations->original;
}
}
}
return parent::getLanguage();
}
/**
* @see EntityTranslationDefaultHandler::entityForm()
*/

View File

@@ -112,9 +112,10 @@ class EntityTranslationHandlerFactory {
*/
public function getHandlerId($entity_type, $entity) {
if (!isset($entity->entity_translation_handler_id)) {
list($id, $revision_id) = entity_extract_ids($entity_type, $entity);
list($id, $revision_id, $bundle) = entity_extract_ids($entity_type, $entity);
$revision_id = isset($revision_id) ? $revision_id : 0;
$entity->entity_translation_handler_id = $entity_type . '-' . (!empty($id) ? 'eid-' . $id . '-' . $revision_id : 'new-' . self::$newId++);
$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;
}