summaryrefslogtreecommitdiffstats
path: root/core/modules/content_translation/content_translation.pages.inc
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/content_translation/content_translation.pages.inc')
-rw-r--r--core/modules/content_translation/content_translation.pages.inc23
1 files changed, 20 insertions, 3 deletions
diff --git a/core/modules/content_translation/content_translation.pages.inc b/core/modules/content_translation/content_translation.pages.inc
index 4d2fefc..d4a7c48 100644
--- a/core/modules/content_translation/content_translation.pages.inc
+++ b/core/modules/content_translation/content_translation.pages.inc
@@ -30,11 +30,10 @@ function content_translation_overview(EntityInterface $entity) {
$rel[$name] = $entity->getSystemPath($name);
}
- $header = array(t('Language'), t('Translation'), t('Source language'), t('Status'), t('Operations'));
$rows = array();
+ $show_source_column = FALSE;
if (\Drupal::languageManager()->isMultilingual()) {
-
// Determine whether the current entity is translatable.
$translatable = FALSE;
foreach (\Drupal::entityManager()->getFieldDefinitions($entity->getEntityTypeId(), $entity->bundle()) as $field_definition) {
@@ -44,6 +43,12 @@ 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 ($translation) use ($original) {
+ return !empty($translation['source']) && $translation['source'] != $original;
+ });
+ $show_source_column = !empty($additional_source_langcodes);
+
foreach ($languages as $language) {
$language_name = $language->name;
$langcode = $language->id;
@@ -125,7 +130,12 @@ function content_translation_overview(EntityInterface $entity) {
$status = t('Not translated');
}
- $rows[] = array($language_name, $row_title, $source_name, $status, $operations);
+ if ($show_source_column) {
+ $rows[] = array($language_name, $row_title, $source_name, $status, $operations);
+ }
+ else {
+ $rows[] = array($language_name, $row_title, $status, $operations);
+ }
}
}
@@ -135,6 +145,13 @@ function content_translation_overview(EntityInterface $entity) {
// which entity this is.
$build['#entity'] = $entity;
+ if ($show_source_column) {
+ $header = array(t('Language'), t('Translation'), t('Source language'), t('Status'), t('Operations'));
+ }
+ else {
+ $header = array(t('Language'), t('Translation'), t('Status'), t('Operations'));
+ }
+
$build['content_translation_overview'] = array(
'#type' => 'table',
'#header' => $header,