src/Controller/FrontendPageController.php
protected function changeViewMode(Request $request, $status, $path)
    {
        if (false === $this->get('security.authorization_checker')->isGranted('ROLE_SONATA_ADMIN')) {
            $message = 'Please login to carry out this action';
            throw new AccessDeniedException($message);
        }

        $request->getSession()->set('_viewStatus', $status);

        if ($path) {
            $url = base64_decode($path);
        } else {
            $url = $this->get('router')->generate('networking_init_cms_default');
        }

        return $this->redirect($url);
    }
protected function changeViewMode(Request $request, $status, $path)
    {
        if (false === $this->get('security.authorization_checker')->isGranted('ROLE_SONATA_ADMIN')) {
            $message = 'Please login to carry out this action';
            throw new AccessDeniedException($message);
        }

        $request->getSession()->set('_viewStatus', $status);

        if ($path) {
            $url = base64_decode($path);
        } else {
            $url = $this->get('router')->generate('networking_init_cms_default');
        }

        return $this->redirect($url);
    }
protected function changeViewMode ( Request $ request , $ status , $ path ) { if ( false === $ this -> get ( 'security.authorization_checker' ) -> isGranted ( 'ROLE_SONATA_ADMIN' ) ) { $ message = 'Please login to carry out this action' ; throw new AccessDeniedException ( $ message ) ; } $ request -> getSession ( ) -> set ( '_viewStatus' , $ status ) ; if ( $ path ) { $ url = base64_decode ( $ path ) ; } else { $ url = $ this -> get ( 'router' ) -> generate ( 'networking_init_cms_default' ) ; } return $ this -> redirect ( $ url ) ; }
Change the page viewing mode to live or draft.

@param Request $request
@param $status
@param $path

@return RedirectResponse

@throws AccessDeniedException
Change the page viewing mode to live or draft .