src/Zicht/Bundle/PageBundle/AdminMenu/EventPropagationBuilder.php
public function buildAndForwardEvent(Event $event)
    {
        if (!$event instanceof PageViewEvent) {
            return;
        }

        $page = $event->getPage();
        $admin = $this->sonata->getAdminByClass(get_class($page));

        if ($admin === null) {
            $admin = $this->sonata->getAdminByClass(get_parent_class($page));
        }

        if ($page->getId() && $admin !== null) {
            $title = $event->getPage()->getTitle();
            /** @var \Zicht\Bundle\PageBundle\Event\PageViewEvent $event */
            /** @var \Zicht\Bundle\PageBundle\Event\PageViewEvent $e */
            $this->eventDispatcher->dispatch(
                AdminEvents::MENU_EVENT,
                new MenuEvent(
                    $admin->generateObjectUrl('edit', $event->getPage()),
                    sprintf(
                        'Beheer pagina "%s"',
                        strlen($title) > 20 ? substr($title, 0, 20) . '...' : $title
                    )
                )
            );
        }
    }
public function buildAndForwardEvent(Event $event)
    {
        if (!$event instanceof PageViewEvent) {
            return;
        }

        $page = $event->getPage();
        $admin = $this->sonata->getAdminByClass(get_class($page));

        if ($admin === null) {
            $admin = $this->sonata->getAdminByClass(get_parent_class($page));
        }

        if ($page->getId() && $admin !== null) {
            $title = $event->getPage()->getTitle();
            /** @var \Zicht\Bundle\PageBundle\Event\PageViewEvent $event */
            /** @var \Zicht\Bundle\PageBundle\Event\PageViewEvent $e */
            $this->eventDispatcher->dispatch(
                AdminEvents::MENU_EVENT,
                new MenuEvent(
                    $admin->generateObjectUrl('edit', $event->getPage()),
                    sprintf(
                        'Beheer pagina "%s"',
                        strlen($title) > 20 ? substr($title, 0, 20) . '...' : $title
                    )
                )
            );
        }
    }
public function buildAndForwardEvent ( Event $ event ) { if ( ! $ event instanceof PageViewEvent ) { return ; } $ page = $ event -> getPage ( ) ; $ admin = $ this -> sonata -> getAdminByClass ( get_class ( $ page ) ) ; if ( $ admin === null ) { $ admin = $ this -> sonata -> getAdminByClass ( get_parent_class ( $ page ) ) ; } if ( $ page -> getId ( ) && $ admin !== null ) { $ title = $ event -> getPage ( ) -> getTitle ( ) ; /** @var \Zicht\Bundle\PageBundle\Event\PageViewEvent $event */ /** @var \Zicht\Bundle\PageBundle\Event\PageViewEvent $e */ $ this -> eventDispatcher -> dispatch ( AdminEvents :: MENU_EVENT , new MenuEvent ( $ admin -> generateObjectUrl ( 'edit' , $ event -> getPage ( ) ) , sprintf ( 'Beheer pagina "%s"' , strlen ( $ title ) > 20 ? substr ( $ title , 0 , 20 ) . '...' : $ title ) ) ) ; } }
Build the relevant event and forward it.

@param \Symfony\Component\EventDispatcher\Event $event
@return null|void
Build the relevant event and forward it .