Problem/Motivation
After upgrading to 9.4.12 to apply the 3/15 security patch SA-CORE-2023-003, the Language switcher block only shows links to accessible translations of pages. Many sites would like to show links for all languages - linking to the translations of the current page where that is accessible, or something else, such as the home page for languages that do not have an accessible translation of the current page.
Steps to reproduce
- Steps to reproduce
- Install all of the core Multilingual modules
- Add another language
- Enable a content type for content translation (including its published field)
- Use URL -> Path for the language detection
- Place the Language switcher content block
- Add a piece of content in one language
- Add a translation of that content in the other language, ensuring to mark it as unpublished
- Log out (so that the user cannot access the unpublished translation)
- View the content. Language switcher block is shown.
- View the content in the other language. Language switcher block does not show any link for the other language.
Proposed resolution
Move the filtering of links for access to them, to after hook_language_switch_links_alter()
has run.
Remaining tasks
Provide patch, with tests.
User interface changes
None, aside for sites that have implementations of hook_language_switch_links_alter()
that operate on links that have been removed since SA-CORE-2023-003, which could see links restored.
API changes
Restores API possibilities from before SA-CORE-2023-003, whilst allowing for that fix to still be imposed.
Data model changes
None