<?php
/*
* @since 1.0.0
* @copyright Copyright (C) 2020 ArtMedia. All rights reserved.
* @website http://artmedia.biz.pl
* @author Arkadiusz Tobiasz
* @email kontakt@artmedia.biz.pl
*/
namespace App\EventSubscriber\Media;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use App\Events\Core\SeoPageAddEvent;
use Symfony\Contracts\Translation\TranslatorInterface;
use App\Model\Core\SeoPage;
class SeoSubscriber implements EventSubscriberInterface
{
protected $translator;
public function __construct(
TranslatorInterface $translator
) {
$this->translator = $translator;
}
public static function getSubscribedEvents(): array
{
return [
SeoPageAddEvent::NAME => 'onSeoPageAddEvent',
];
}
public function onSeoPageAddEvent(SeoPageAddEvent $event): void
{
$pages = [
(new SeoPage())->setName($this->translator->trans('Album Page', [], 'admin'))->setRoute('portfolio_album_index')->setParams([
'%profile%', '%album%'
]),
(new SeoPage())->setName($this->translator->trans('Album Page Paginated', [], 'admin'))->setRoute('portfolio_album_index_paginated')->setParams([
'%profile%', '%album%', '%page%'
]),
(new SeoPage())->setName($this->translator->trans('Add Profile Album Page', [], 'admin'))->setRoute('portfolio_album_new')->setParams([
'%profile%'
]),
(new SeoPage())->setName($this->translator->trans('Add Album Page', [], 'admin'))->setRoute('album_new'),
(new SeoPage())->setName($this->translator->trans('Album Edit Page', [], 'admin'))->setRoute('portfolio_album_edit')->setParams([
'%profile%', '%album%'
]),
(new SeoPage())->setName($this->translator->trans('Album Manage Page', [], 'admin'))->setRoute('portfolio_album_manage')->setParams([
'%profile%', '%album%'
]),
(new SeoPage())->setName($this->translator->trans('Album Credited Manage Page', [], 'admin'))->setRoute('portfolio_credited_manage')->setParams([
'%profile%',
]),
(new SeoPage())->setName($this->translator->trans('Media List Page', [], 'admin'))->setRoute('media_index'),
(new SeoPage())->setName($this->translator->trans('Media List Page Paginated', [], 'admin'))->setRoute('media_index_paginated')->setParams([
'%page%',
]),
(new SeoPage())->setName($this->translator->trans('Media Tag List Page', [], 'admin'))->setRoute('media_tag')->setParams([
'%tag%',
]),
(new SeoPage())->setName($this->translator->trans('Media Tag List Page Paginated', [], 'admin'))->setRoute('media_tag_paginated')->setParams([
'%tag%', '%page%',
]),
(new SeoPage())->setName($this->translator->trans('Photos Manage Page', [], 'admin'))->setRoute('portfolio_photo_index')->setParams([
'%profile%',
]),
(new SeoPage())->setName($this->translator->trans('Photos Manage Page Paginated', [], 'admin'))->setRoute('portfolio_photo_paginated')->setParams([
'%profile%', '%page%'
]),
(new SeoPage())->setName($this->translator->trans('Edit Photo Page', [], 'admin'))->setRoute('portfolio_photo_edit')->setParams([
'%profile%',
]),
(new SeoPage())->setName($this->translator->trans('Edit Credited Photo Page', [], 'admin'))->setRoute('portfolio_photo_credited')->setParams([
'%profile%',
]),
(new SeoPage())->setName($this->translator->trans('Upload Profile Photo Page', [], 'admin'))->setRoute('portfolio_photo_upload')->setParams([
'%profile%',
]),
(new SeoPage())->setName($this->translator->trans('Upload Photo Page', [], 'admin'))->setRoute('photo_upload'),
(new SeoPage())->setName($this->translator->trans('Upload Profile Photo Page', [], 'admin'))->setRoute('portfolio_photo_upload')->setParams([
'%profile%',
]),
(new SeoPage())->setName($this->translator->trans('Portfolio Page', [], 'admin'))->setRoute('portfolio')->setParams([
'%profile%',
]),
(new SeoPage())->setName($this->translator->trans('Portfolio Album View Page', [], 'admin'))->setRoute('portfolio_album')->setParams([
'%profile%', '%album%',
]),
(new SeoPage())->setName($this->translator->trans('Portfolio Credited Album View Page', [], 'admin'))->setRoute('portfolio_credited')->setParams([
'%profile%',
]),
(new SeoPage())->setName($this->translator->trans('Photo View Page', [], 'admin'))->setRoute('portfolio_photo')->setParams([
'%profile%',
]),
];
foreach ($pages as $page) {
$event->addPage($page);
}
}
}