summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgit2018-08-17 21:40:33 (GMT)
committerJoseph Olstad2018-08-17 21:41:16 (GMT)
commitcb4aa587eca640e73866b0613efe8ed5de4b7ae4 (patch)
tree7b81a8fba2abb94bd9afb88118b75331c658bd0b
parent73577fa27beb8dc9d5b47a9f02730610e2a57c33 (diff)
Issue #2988670 by .bert: Fatal Error 'getActiveLanguage() on a non-object' with Conditional Fields & Entity Translation
-rw-r--r--includes/media.fields.inc8
1 files changed, 5 insertions, 3 deletions
diff --git a/includes/media.fields.inc b/includes/media.fields.inc
index 6240b5c..ce750af 100644
--- a/includes/media.fields.inc
+++ b/includes/media.fields.inc
@@ -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)) {