Commit 6f88fc28 authored by git's avatar git Committed by joseph.olstad

Issue #2856016 by stevieegee: REVERT #2855151 Update Entity translation API usage in Media

parent fc30a0e1
......@@ -37,7 +37,7 @@ class MediaEntityTranslationHandler extends EntityTranslationDefaultHandler {
if ($this->getPathScheme() == 'media') {
$language = $GLOBALS[LANGUAGE_TYPE_CONTENT];
$form_langcode = $this->getActiveLanguage();
$form_langcode = $this->getFormLanguage();
$source_langcode = $this->getSourceLanguage();
$translations = $this->getTranslations();
......
......@@ -126,7 +126,7 @@ function media_field_widget_form(&$form, &$form_state, $field, $instance, $langc
// on the elements for further usage in media_element_process().
if (module_invoke('entity_translation', 'enabled', $element['#entity_type'], $element['#entity'])) {
$translation_handler = entity_translation_get_handler($element['#entity_type'], $element['#entity']);
$element['#media_parent_entity_form_langcode'] = $translation_handler->getActiveLanguage();
$element['#media_parent_entity_form_langcode'] = $translation_handler->getFormLanguage();
if ($source_langcode = $translation_handler->getSourceLanguage()) {
$element['#media_parent_entity_source_langcode'] = $source_langcode;
}
......
......@@ -19,7 +19,7 @@ function media_file_edit_modal($form, &$form_state, $file, $js) {
if (isset($languages[$_GET['media_parent_entity_form_langcode']])) {
$langcode = $_GET['media_parent_entity_form_langcode'];
$translation_handler = entity_translation_get_handler('file', $file);
$translation_handler->setActiveLanguage($langcode);
$translation_handler->setFormLanguage($langcode);
$translations = $translation_handler->getTranslations();
if (!isset($translations->data[$langcode])) {
if (!empty($_GET['media_parent_entity_source_langcode']) && is_string($_GET['media_parent_entity_source_langcode']) && isset($translations->data[$_GET['media_parent_entity_source_langcode']])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment