Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
eZ\Publish\Core\MVC\Symfony\EventListener\LanguageSwitchListener Class Reference

Listener for language switcher. More...

Inheritance diagram for eZ\Publish\Core\MVC\Symfony\EventListener\LanguageSwitchListener:

## Public Member Functions
| __construct (TranslationHelper $translationHelper)
| onRouteReferenceGeneration (RouteReferenceGenerationEvent $event)
| If "language" parameter is present, will try to get corresponding SiteAccess for translation. More...

## Static Public Member Functions
static | getSubscribedEvents ()

## Private Attributes
| $translationHelper

## Detailed Description

Listener for language switcher.

Will be triggered when generating a RouteReference.

Definition at line 18 of file LanguageSwitchListener.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\MVC\Symfony\EventListener\LanguageSwitchListener::__construct | ( | TranslationHelper | $translationHelper | ) |

Definition at line 23 of file LanguageSwitchListener.php.

References eZ\Publish\Core\MVC\Symfony\EventListener\LanguageSwitchListener\$translationHelper.

## Member Function Documentation

## ◆ getSubscribedEvents()

static eZ\Publish\Core\MVC\Symfony\EventListener\LanguageSwitchListener::getSubscribedEvents | ( |  | ) |
| static

Definition at line 28 of file LanguageSwitchListener.php.

References eZ\Publish\Core\MVC\Symfony\MVCEvents\ROUTE_REFERENCE_GENERATION.

## ◆ onRouteReferenceGeneration()

eZ\Publish\Core\MVC\Symfony\EventListener\LanguageSwitchListener::onRouteReferenceGeneration | ( | RouteReferenceGenerationEvent | $event | ) |

If "language" parameter is present, will try to get corresponding SiteAccess for translation.

If found, it will add "siteaccess" parameter to the RouteReference, to trigger SiteAccess switch when generating the final link.

See also
  \eZ\Publish\Core\MVC\Symfony\Routing\Generator::generate()
  \eZ\Publish\Core\MVC\Symfony\Routing\Generator\UrlAliasGenerator::doGenerate()

Parameters

  \eZ\Publish\Core\MVC\Symfony\Event\RouteReferenceGenerationEvent | $event |

Definition at line 45 of file LanguageSwitchListener.php.

References eZ\Publish\Core\MVC\Symfony\Event\RouteReferenceGenerationEvent\getRouteReference().

## Member Data Documentation

## ◆ $translationHelper

eZ\Publish\Core\MVC\Symfony\EventListener\LanguageSwitchListener::$translationHelper
| private

Definition at line 21 of file LanguageSwitchListener.php.

Referenced by eZ\Publish\Core\MVC\Symfony\EventListener\LanguageSwitchListener\__construct().

The documentation for this class was generated from the following file:

- LanguageSwitchListener.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.