@@ -38,18 +38,26 @@ function interledger_preprocess_html(&$variables) {
3838/**
3939 * Prepares a translation disclaimer flag for block--interledger-content.
4040 *
41- * Sets `showTranslationDisclaimer` to TRUE if the current node lacks a translation
42- * in the active language.
41+ * Sets `showTranslationDisclaimer` to TRUE if:
42+ * - The current node lacks a translation in the active language, OR
43+ * - We're on a non-node page (views, listings, etc.) in a non-default language
4344 */
4445function interledger_preprocess_block__interledger_content(&$variables) {
4546 $default_language = \Drupal::languageManager()->getDefaultLanguage()->getId();
4647 $current_language = \Drupal::languageManager()->getCurrentLanguage()->getId();
4748 $node = \Drupal::routeMatch()->getParameter('node');
4849 $variables['showTranslationDisclaimer'] = false;
4950
50- if ($node instanceof Node && $current_language !== $default_language) {
51- $hasTranslation = $node->hasTranslation($current_language);
52- if (!$hasTranslation) {
51+ // Only check if we're not in the default language
52+ if ($current_language !== $default_language) {
53+ if ($node instanceof Node) {
54+ // For node pages, check if translation exists
55+ $hasTranslation = $node->hasTranslation($current_language);
56+ if (!$hasTranslation) {
57+ $variables['showTranslationDisclaimer'] = true;
58+ }
59+ } else {
60+ // For non-node pages (views, listings, etc.), show disclaimer by default
5361 $variables['showTranslationDisclaimer'] = true;
5462 }
5563 }
0 commit comments