Bundle/PageBundle/Helper/PageHelper.php
public function renderPage($view, $layout = null)
    {
        $event = new PageMenuContextualEvent($view);

        //Set currentView and dispatch victoire.on_render_page event with this currentView
        $pageRenderEvent = new PageRenderEvent($view);
        $this->eventDispatcher->dispatch('victoire.on_render_page', $pageRenderEvent);
        $this->currentViewHelper->setCurrentView($view);

        //Build WidgetMap
        $this->widgetMapBuilder->build($view, true);

        //Populate widgets with their data
        $this->widgetDataWarmer->warm($this->entityManager, $view);

        //Dispatch contextual event regarding page type
        if (in_array($view->getType(), ['business_page', 'virtual_business_page'])) {
            //Dispatch also an event with the Business entity name
            $eventName = 'victoire_core.page_menu.contextual';
            if (!$view->getId()) {
                $eventName = 'victoire_core.business_template_menu.contextual';
                $event = new PageMenuContextualEvent($view->getTemplate());
            }
            $this->eventDispatcher->dispatch($eventName, $event);
            $type = $view->getBusinessEntityId();
        } else {
            $type = $view->getType();
        }

        $eventName = 'victoire_core.'.$type.'_menu.contextual';
        $this->eventDispatcher->dispatch($eventName, $event);

        if (null === $layout) {
            //Determine which layout to use
            $layout = $this->guessBestLayoutForView($view);
        }
        $globalConfig = $this->entityManager->getRepository(GlobalConfig::class)->findLast() ?: new GlobalConfig();

        //Create the response
        $response = $this->container->get('templating')->renderResponse('VictoireCoreBundle:Layout:'.$layout.'.html.twig', [
            'globalConfig'                    => $globalConfig,
            'victoire_i18n_available_locales' => $this->availableLocales,
            'victoire_twig_responsive'        => $this->twigResponsive,
            'view'                            => $view,
        ]);

        return $response;
    }
public function renderPage($view, $layout = null)
    {
        $event = new PageMenuContextualEvent($view);

        //Set currentView and dispatch victoire.on_render_page event with this currentView
        $pageRenderEvent = new PageRenderEvent($view);
        $this->eventDispatcher->dispatch('victoire.on_render_page', $pageRenderEvent);
        $this->currentViewHelper->setCurrentView($view);

        //Build WidgetMap
        $this->widgetMapBuilder->build($view, true);

        //Populate widgets with their data
        $this->widgetDataWarmer->warm($this->entityManager, $view);

        //Dispatch contextual event regarding page type
        if (in_array($view->getType(), ['business_page', 'virtual_business_page'])) {
            //Dispatch also an event with the Business entity name
            $eventName = 'victoire_core.page_menu.contextual';
            if (!$view->getId()) {
                $eventName = 'victoire_core.business_template_menu.contextual';
                $event = new PageMenuContextualEvent($view->getTemplate());
            }
            $this->eventDispatcher->dispatch($eventName, $event);
            $type = $view->getBusinessEntityId();
        } else {
            $type = $view->getType();
        }

        $eventName = 'victoire_core.'.$type.'_menu.contextual';
        $this->eventDispatcher->dispatch($eventName, $event);

        if (null === $layout) {
            //Determine which layout to use
            $layout = $this->guessBestLayoutForView($view);
        }
        $globalConfig = $this->entityManager->getRepository(GlobalConfig::class)->findLast() ?: new GlobalConfig();

        //Create the response
        $response = $this->container->get('templating')->renderResponse('VictoireCoreBundle:Layout:'.$layout.'.html.twig', [
            'globalConfig'                    => $globalConfig,
            'victoire_i18n_available_locales' => $this->availableLocales,
            'victoire_twig_responsive'        => $this->twigResponsive,
            'view'                            => $view,
        ]);

        return $response;
    }
public function renderPage ( $ view , $ layout = null ) { $ event = new PageMenuContextualEvent ( $ view ) ; //Set currentView and dispatch victoire.on_render_page event with this currentView $ pageRenderEvent = new PageRenderEvent ( $ view ) ; $ this -> eventDispatcher -> dispatch ( 'victoire.on_render_page' , $ pageRenderEvent ) ; $ this -> currentViewHelper -> setCurrentView ( $ view ) ; //Build WidgetMap $ this -> widgetMapBuilder -> build ( $ view , true ) ; //Populate widgets with their data $ this -> widgetDataWarmer -> warm ( $ this -> entityManager , $ view ) ; //Dispatch contextual event regarding page type if ( in_array ( $ view -> getType ( ) , [ 'business_page' , 'virtual_business_page' ] ) ) { //Dispatch also an event with the Business entity name $ eventName = 'victoire_core.page_menu.contextual' ; if ( ! $ view -> getId ( ) ) { $ eventName = 'victoire_core.business_template_menu.contextual' ; $ event = new PageMenuContextualEvent ( $ view -> getTemplate ( ) ) ; } $ this -> eventDispatcher -> dispatch ( $ eventName , $ event ) ; $ type = $ view -> getBusinessEntityId ( ) ; } else { $ type = $ view -> getType ( ) ; } $ eventName = 'victoire_core.' . $ type . '_menu.contextual' ; $ this -> eventDispatcher -> dispatch ( $ eventName , $ event ) ; if ( null === $ layout ) { //Determine which layout to use $ layout = $ this -> guessBestLayoutForView ( $ view ) ; } $ globalConfig = $ this -> entityManager -> getRepository ( GlobalConfig :: class ) -> findLast ( ) ? : new GlobalConfig ( ) ; //Create the response $ response = $ this -> container -> get ( 'templating' ) -> renderResponse ( 'VictoireCoreBundle:Layout:' . $ layout . '.html.twig' , [ 'globalConfig' => $ globalConfig , 'victoire_i18n_available_locales' => $ this -> availableLocales , 'victoire_twig_responsive' => $ this -> twigResponsive , 'view' => $ view , ] ) ; return $ response ; }
Generates a response from a page.

@param View        $view
@param string|null $layout

@return Response
Generates a response from a page .