Example #1
0
 /**
  * publishPageRevisionAction
  *
  * @return Response|\Zend\Http\Response
  * @throws \Rcm\Exception\InvalidArgumentException
  */
 public function publishPageRevisionAction()
 {
     if (!$this->rcmIsAllowed('sites.' . $this->currentSite->getSiteId() . '.pages', 'create')) {
         $response = new Response();
         $response->setStatusCode('401');
         return $response;
     }
     $pageName = $this->getEvent()->getRouteMatch()->getParam('rcmPageName', 'index');
     $pageRevision = $this->getEvent()->getRouteMatch()->getParam('rcmPageRevision', null);
     $pageType = $this->getEvent()->getRouteMatch()->getParam('rcmPageType', 'n');
     if (!is_numeric($pageRevision)) {
         throw new InvalidArgumentException('Invalid Page Revision Id.');
     }
     $this->pageRepo->publishPageRevision($this->currentSite->getSiteId(), $pageName, $pageType, $pageRevision);
     return $this->redirect()->toUrl($this->urlToPage($pageName, $pageType));
 }