diff --git a/core/modules/content_translation/content_translation.pages.inc b/core/modules/content_translation/content_translation.pages.inc index 017da96..7ed5a3c 100644 --- a/core/modules/content_translation/content_translation.pages.inc +++ b/core/modules/content_translation/content_translation.pages.inc @@ -31,6 +31,7 @@ function content_translation_overview(EntityInterface $entity) { } $rows = array(); + $show_source_column = FALSE; if (\Drupal::languageManager()->isMultilingual()) { // Determine whether the current entity is translatable. @@ -43,10 +44,9 @@ function content_translation_overview(EntityInterface $entity) { } // Show source-language column if there are non-original source langcodes. - $additional_source_langcodes = array_filter($entity->translation, function ($a) use ($original) { - return isset($a['source']) && $a['source'] && $a['source'] != $original; - }); - $show_source_column = count($additional_source_langcodes) > 0; + $show_source_column = !empty($entity->translation) && !empty(array_filter($entity->translation, function ($translation) use ($original) { + return !empty($translation['source']) && $translation['source'] != $original; + })); foreach ($languages as $language) { $language_name = $language->name; @@ -144,7 +144,7 @@ function content_translation_overview(EntityInterface $entity) { // which entity this is. $build['#entity'] = $entity; - if (isset($show_source_column) && $show_source_column == TRUE) { + if ($show_source_column) { $header = array(t('Language'), t('Translation'), t('Source language'), t('Status'), t('Operations')); } else {