Allow hide language switcher block when the page is not translatable

Created on 22 December 2020, almost 4 years ago
Updated 5 May 2023, over 1 year ago

Problem/Motivation

In a site with the language switcher added as a block, when there are no languages to select, the block title still appears.
The expected behaviour is to don't appear as there doesn't appear link to select.

Steps to reproduce

1) Configure language switcher extended to hide non-translatable links.
2) Add language switcher as a block with any title.

When you go to a non-translatable page, the block title appears without selectors.

Proposed resolution

Allow users to configure language switcher link processor to set the links as null when there aren't links.
It will make the block disappear, as drupal language block check if the links are set https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/modules/lang....

It's configurable because is possible that some users don't want to hide the block, but an alternative message when there are not available languages.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain omarlopesino

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States l-laziz

    The changes in this commit cause PHP fatal error with Core update 9.5.9 because it expects an array value, however NULL is given.
    This looks like the change (git diff) from the merged commit causing error:

          - $links = [];
          + $links = $config->get('hide_single_link_block') ? NULL : [];
    

    The Core 9.5.9 doesn't accept NULL value anymore.

Production build 0.71.5 2024