Skip to content

[BUGFIX] Only offer languages with page translation - #37

Open
achimfritz wants to merge 1 commit into
mainfrom
bugfix/languages
Open

achimfritz wants to merge 1 commit into
mainfrom
bugfix/languages

Conversation

@achimfritz

Copy link
Copy Markdown
Contributor

The link browser listed every language of the site for a page, even if the page had no translation in that language. Editors could thus create links to non-existing page translations.

getAllLanguages() now checks which translations of the page exist and only returns those languages. The default language and "all languages" (-1) are always kept.

@achimfritz
achimfritz requested a review from bmack September 25, 2026 13:35
@achimfritz
achimfritz force-pushed the bugfix/languages branch 2 times, most recently from a7a6345 to ba44279 Compare September 25, 2026 13:37
The link browser listed every language of the site for a page, even
if the page had no translation in that language. Editors could thus
create links to non-existing page translations.

getAllLanguages() now checks which translations of the page exist
and only returns those languages. The default language and "all
languages" (-1) are always kept.
$site = $this->siteFinder->getSiteByPageId($pageId);
$languages = $site->getAvailableLanguages($this->getBackendUser(), true);
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('pages');
$queryBuilder->getRestrictions()->removeAll()->add(new DeletedRestriction());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do that but it's not WS-aware.

In v14 we do have methods in LocalizationRepository I think for this, but we can use this at a later version then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants