The getLanguages
hook allows to modify the system’s list of languages.
array $compiledLanguages
The array containing the languages as filled by \Contao\System::getLanguages()
according
to the system configuration. This parameter has to be passed by reference if you
want your changes to become effective.
array $languages
The list of languages from the system config file languages.php
with english
language names.
array $langsNative
The list of languages with native language names (also read from from the system
config file languages.php
).
bool $installedOnly
Indicates whether only languages installed in the back end should be considered in the result.
// src/EventListener/GetLanguagesListener.php
namespace App\EventListener;
use Contao\CoreBundle\ServiceAnnotation\Hook;
/**
* @Hook("getLanguages")
*/
class GetLanguagesListener
{
public function __invoke(array &$compiledLanguages, array $languages, array $langsNative, bool $installedOnly): void
{
// Make your changes to $compiledLanguages
}
}