LanguageSelectorBuilder
final readonly class \
Builds the language selector dropdown for backend modules (Layout, Records, Recycler, record history).
This centralizes the language selection UI logic to ensure consistent behavior across all modules. It handles both single-select (radio buttons) and multi-select (toggles/checkboxes) modes.
Internal
Table of Contents
Methods
- __construct() : mixed
- build() : ButtonInterface
- buildForSiteLanguages() : ButtonInterface
- Builds a single-select language selector for the given site languages, independent of the translations existing on a page, optionally with an entry for all languages.
Methods
__construct()
public
__construct(ComponentFactory $componentFactory, IconFactory $iconFactory) : mixed
Parameters
- $componentFactory : ComponentFactory
- $iconFactory : IconFactory
build()
public
build(PageContext $pageContext, LanguageSelectorMode $mode, Closure $urlBuilder[, bool $showToggleAll = true ]) : ButtonInterface
Parameters
- $pageContext : PageContext
- $mode : LanguageSelectorMode
- $urlBuilder : Closure
- $showToggleAll : bool = true
Return values
ButtonInterfacebuildForSiteLanguages()
Builds a single-select language selector for the given site languages, independent of the translations existing on a page, optionally with an entry for all languages.
public
buildForSiteLanguages(SiteLanguage[] $siteLanguages, int|null $selectedLanguageId, callable(int|null): string $urlBuilder[, bool $showAllLanguages = true ]) : ButtonInterface
Used by modules filtering or switching records by language.
Parameters
- $siteLanguages : SiteLanguage[]
- $selectedLanguageId : int|null
-
Null for all languages
- $urlBuilder : callable(int|null): string
- $showAllLanguages : bool = true