<?php
/**
* gpl-3.0 license
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @package shop6.liebscher-bracht.com
* @author Michael Lämmlein <michael.laemmlein@liebscher-bracht.com>
* @copyright ©2024 Liebscher & Bracht
* @license https://www.gnu.org/licenses/gpl-3.0.html
* @version 1.0.0
* @since 05.02.24
*/
declare(strict_types=1);
namespace Lnb\Shopware6\LnbThemeDefault\Subscriber;
use Shopware\Storefront\Page\Navigation\Error\ErrorPageLoadedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
readonly class ErrorPageLoadedSubscriber implements EventSubscriberInterface
{
public function __construct(
private TranslatorInterface $translator,
) {
}
public static function getSubscribedEvents()
{
return [
ErrorPageLoadedEvent::class => 'onErrorPageLoaded',
];
}
public function onErrorPageLoaded(ErrorPageLoadedEvent $event): void
{
$event
->getPage()
->getMetaInformation()
->setMetaTitle($this->translator->trans('LnbThemeDefault.page.error.404PageTitle'));
}
}