Problem/Motivation

Sites that run `language_switcher_dialog_countries` alongside the `disable_language`
contrib module currently have no integration between the two: the `grouped_by_region`
provider renders links for all languages regardless of the `'view disabled languages'`
permission, and the render cache does not vary by `user.permissions`.

Steps to reproduce

1. Install `language_switcher_dialog_countries` and `disable_language`.
2. Create at least two site languages, e.g. English and French.
3. Disable French via `/admin/config/regional/language` using the
`disable_language` controls.
4. Enable the new `language_switcher_dialog_disable_language` integration submodule.
5. As an anonymous user (or a user **without** "view disabled languages"),
open the language switcher dialog.
6. **Desired**: French is hidden from the dialog.
7. As a user **with** "view disabled languages", open the dialog.
8. **Desired**: French appears in the dialog.

Proposed resolution

Rather than modifying `RegionGroupedProvider` directly (which would force
`disable_language` awareness on every site), the integration is packaged as a
new companion submodule:

```
modules/language_switcher_dialog_disable_language/
├── language_switcher_dialog_disable_language.info.yml
├── language_switcher_dialog_disable_language.module
└── src/
└── Plugin/
└── DialogContentProvider/
└── DisableLanguageRegionGroupedProvider.php
```

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#4 admin.PNG84.38 KBangel_devoeted
#4 user.PNG91.42 KBangel_devoeted
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aren33k created an issue. See original summary.

aren33k’s picture

Status: Active » Needs review
angel_devoeted’s picture

StatusFileSize
new91.42 KB
new84.38 KB

Reviewed the MR !3 and tested on Drupal 11.x.x via DrupalForge
Code looks solid.
Confirmed that disabled languages are correctly hidden for anonymous users and visible for admins.
Works as expected.

Admin view:
admin

Anonymous User view:
user

svendecabooter made their first commit to this issue’s fork.

svendecabooter’s picture

Thanks for the MR and extra functionality.

See my MR comment above.

Can you retest if the generic hook approach still works for you? Hopefully that would be a good extension point where other modules can also plug into, if needed.

angel_devoeted’s picture

Thanks for the clean refactor, @svendecabooter!

Retested the updated MR !3.
The new alter hook implementation works as expected.
Disabled languages are properly hidden for anonymous users and remain visible for administrators.

svendecabooter’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

svendecabooter’s picture

Assigned: aren33k » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.