Networking\InitCmsBundle\Controller\FrontendPageController::getDraftParameters PHP 메소드

getDraftParameters() 공개 메소드

public getDraftParameters ( Request $request, Networking\InitCmsBundle\Model\PageInterface $page )
$request Symfony\Component\HttpFoundation\Request
$page Networking\InitCmsBundle\Model\PageInterface
    public function getDraftParameters(Request $request, PageInterface $page)
    {
        if ($redirect = $this->getRedirect($request, $page)) {
            return $redirect;
        }
        if ($page->getVisibility() != PageInterface::VISIBILITY_PUBLIC) {
            if (false === $this->get('security.authorization_checker')->isGranted('ROLE_USER')) {
                throw new AccessDeniedException();
            }
        }
        if ($page->getStatus() != PageInterface::STATUS_PUBLISHED) {
            if (!$this->get('security.token_storage')->getToken() || false === $this->get('security.authorization_checker')->isGranted('ROLE_SONATA_ADMIN')) {
                $message = 'The requested page has the status "' . $page->getStatus() . '", please login to view page';
                throw $this->createNotFoundException($message);
            }
        }
        return array('page' => $page, 'admin_pool' => $this->getAdminPool());
    }