Code Duplication    Length = 16-17 lines in 2 locations

Bundle/BlogBundle/Listener/BlogMenuListener.php 1 location

@@ 34-50 (lines=17) @@
31
     *
32
     * @return \Knp\Menu\ItemInterface
33
     */
34
    public function addContextual($event)
35
    {
36
        $floatActionDropdown = $this->menuBuilder->getFloatActionDropdown();
37
38
        $currentArticle = $event->getPage()->getBusinessEntity();
39
        $currentBlog = $currentArticle->getBlog();
40
41
        $floatActionDropdown->addChild('menu.blog.article.new',
42
            [
43
                'route'           => 'victoire_blog_article_new',
44
                'routeParameters' => ['id' => $currentBlog->getId()],
45
                'linkAttributes'  => [
46
                    'class' => 'v-drop__anchor',
47
                ],
48
            ]
49
        )->setLinkAttribute('data-toggle', 'vic-modal');
50
    }
51
52
    /**
53
     * add a blog contextual menu item.

Bundle/TemplateBundle/Listener/TemplateMenuListener.php 1 location

@@ 32-47 (lines=16) @@
29
     *
30
     * @return \Knp\Menu\ItemInterface <\Knp\Menu\ItemInterface, NULL>
31
     */
32
    public function addContextual($event)
33
    {
34
        $menuBottomRight = $this->menuBuilder->getBottomRightNavbar();
35
        $template = $event->getTemplate();
36
37
        //this contextual menu appears only for template
38
        $menuBottomRight->addChild('menu.template.settings',
39
            [
40
                'route'           => 'victoire_template_settings',
41
                'routeParameters' => ['id' => $template->getId()],
42
                'linkAttributes'  => [
43
                    'class' => 'v-btn v-btn--sm v-btn--transparent',
44
                ],
45
            ]
46
        )->setLinkAttribute('data-toggle', 'vic-modal');
47
    }
48
49
    /**
50
     * add a global menu item.