Hide language switcher block when there is only one language enabled

Created on 21 February 2018, almost 7 years ago
Updated 9 August 2023, over 1 year ago

Hide language switcher block when there is only one language enabled.

We need to see if it is possible to hide the block if only one language is enabled.

Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

🇧🇪Belgium nielsaers

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.

  • 🇫🇷France Grimreaper France 🇫🇷
  • @grimreaper opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇫🇷France Grimreaper France 🇫🇷

    Before:

    After:

    I will also open an issue on core or search for an existing one. Because the list is empty ok, but the block is still present.

  • 🇫🇷France Grimreaper France 🇫🇷

    To avoid core patch.

    I will try an approach based on hook_block_access, as this is where core does its logic to not display the block when there is only one language;

  • @grimreaper opened merge request.
  • 🇫🇷France Grimreaper France 🇫🇷

    I have created a separated MR for the approach with hook_block_access.

    I discovered that hook_block_access and hook_block_build_alter are not triggered when blocks are displayed in Layout Builder.

    I think having a language switcher block rendered in Layout Builder is a very rare case (at least for now) but it may exist if for example you want to administer a header or footer with an entity like Config Page or maybe you use Page Manager.

    Hence 2 MR so people can choose for now.

  • Issue was unassigned.
  • 🇫🇷France Grimreaper France 🇫🇷

    Uploading patches from MRs for easier Composer usage.

  • 🇫🇷France Grimreaper France 🇫🇷

    For Layout Builder block, an event subscriber listening to LayoutBuilderEvents::SECTION_COMPONENT_BUILD_RENDER_ARRAY should be implemented if needed.

    Waiting for maintainers feedback.

Production build 0.71.5 2024