- Issue created by @l-laziz
- ๐บ๐ธUnited States mihaic
Hi I am seeing this in 9.5.9 and in 10.0.9.
This is due to this change in core:
https://www.drupal.org/project/drupal/issues/3348686 ๐ [regression] Inaccessible language switcher links are removed before alternatives can be provided Fixedhere is small patch, maybe there is a better way but this seems to work for us
thanks
- ๐บ๐ธUnited States l-laziz
@mihaic,
Thanks for the info. The patch in #3 doesn't work fully, since the language switcher block becomes visible when the value is set to an empty array []. - ๐ฎ๐ณIndia keshavv India
keshav.k โ made their first commit to this issueโs fork.
- last update
over 1 year ago 2 fail - last update
over 1 year ago 2 fail - Open on Drupal.org โCore: 9.5.x + Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - @keshavk opened merge request.
- last update
over 1 year ago 2 fail - Status changed to Needs review
over 1 year ago 8:45am 11 May 2023 - ๐ฎ๐ณIndia keshavv India
I have reverted the code to previous one. Because this is not a valid condition.
$links = $config->get('hide_single_link_block') ? NULL : [];
We have to set empty array if there is only one link.
- ๐ช๐ธSpain orodicio
- ๐บ๐ธUnited States l-laziz
@keshav.k,
As mentioned earlier, just setting it to an empty array instead of NULL, causes the empty block to show on the page. The block is still rendered as empty. Just reverting the commit back doesn't fix the issue. - Status changed to Active
over 1 year ago 6:11pm 11 May 2023 - First commit to issue fork.
- last update
over 1 year ago 2 fail - Status changed to Needs review
over 1 year ago 7:43pm 12 May 2023 - ๐บ๐ธUnited States jasonfelix
This resolves it for me as well. Thank you.
- ๐ฉ๐ชGermany szeidler Berlin
Let's keep an eye on ๐ LanguageManager does not check against altered language_switch_links Needs review
- ๐บ๐ธUnited States devkinetic
I also ran into this. Adding the patch from ๐ LanguageManager does not check against altered language_switch_links Needs review seems to help. I've not added the MR from this issue into my codebase. The issue only presents itself when logged out.
Furthermore, I've added a custom module the provides further link altering after this module, but found that I had to do two things to make it work:
- Removed the typehinting within the function params.
array &$links
becomes&$links
- Wrap my processor in a
if (is_array($links))
So it seems that $links gets set to NULL instead of an empty array at some point by this module. As I said, I have not added this MR yest as it is not ready, but something to keep in mind when completing it, users may want to provide their own filtering afterwards!
function MYMODULE_language_switch_links_alter(&$links, $type, Url $url) { if (is_array($links)) { // custom code } }
- Removed the typehinting within the function params.