Commit cb4aa587 authored by git's avatar git Committed by joseph.olstad

Issue #2988670 by .bert: Fatal Error 'getActiveLanguage() on a non-object'...

Issue #2988670 by .bert: Fatal Error 'getActiveLanguage() on a non-object' with Conditional Fields & Entity Translation
parent 73577fa2
......@@ -127,9 +127,11 @@ 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();
if ($source_langcode = $translation_handler->getSourceLanguage()) {
$element['#media_parent_entity_source_langcode'] = $source_langcode;
if ($translation_handler) {
$element['#media_parent_entity_form_langcode'] = $translation_handler->getActiveLanguage();
if ($source_langcode = $translation_handler->getSourceLanguage()) {
$element['#media_parent_entity_source_langcode'] = $source_langcode;
}
}
}
elseif (module_exists('translation') && $element['#entity_type'] == 'node' && translation_supported_type($element['#entity']->type)) {
......
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