Completed
Push — development ( bd830d...51f25d )
by Thomas
18s
created

MenuSubscriber::getSubscribedEvents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 1
b 1
f 0
1
<?php
2
3
namespace Oc\Page\Subscriber;
4
5
use Oc\Menu\Event\MenuEvent;
6
use Oc\Menu\MenuEnum;
7
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
8
9
/**
10
 * Class MenuSubscriber
11
 */
12
class MenuSubscriber implements EventSubscriberInterface
13
{
14
    /**
15
     * Returns an array of event names this subscriber wants to listen to.
16
     *
17
     * @return array The event names to listen to
18
     */
19
    public static function getSubscribedEvents()
20
    {
21
        return [
22
            MenuEnum::MENU_MAIN => ['onConfigureMenuMain', 50],
23
        ];
24
    }
25
26
    /**
27
     * @param MenuEvent $event
28
     */
29
    public function onConfigureMenuMain(MenuEvent $event)
30
    {
31
        $event->getCurrentItem()->addChild(
32
            'tos',
33
            [
34
                'label' => 'Nutzungsbedingungen',
35
                'uri' => '/articles.php?page=impressum#tos'
36
            ]
37
        );
38
39
        $event->getCurrentItem()->addChild(
40
            'privacy_policy',
41
            [
42
                'label' => 'Datenschutzerklärung',
43
                'route' => 'page',
44
                'routeParameters' => [
45
                    'slug' => 'datenschutzerklaerung'
46
                ],
47
            ]
48
        );
49
50
        $event->getCurrentItem()->addChild(
51
            'imprint',
52
            [
53
                'label' => 'Impressum',
54
                'uri' => '/articles.php?page=impressum'
55
            ]
56
        );
57
    }
58
}
59