Author: Yorkie Chadwick (y.chadwick@networking.ch)
 /**
  * @param ContentRouteInterface $contentRoute
  * @param $path
  * @param $content
  * @return Route
  */
 public static function generateRoute(ContentRouteInterface $contentRoute, $path, $content)
 {
     $template = new Template(array('template' => $contentRoute->getTemplate()));
     $defaults = array('route_params' => '', Route::LOCALE => $contentRoute->getLocale(), RouteObjectInterface::CONTROLLER_NAME => $contentRoute->getController(), RouteObjectInterface::TEMPLATE_NAME => $template, RouteObjectInterface::CONTENT_OBJECT => $content);
     return new Route($path, $defaults);
 }
Ejemplo n.º 2
0
 public function findContentByContentRoute(ContentRouteInterface $contentRoute)
 {
     $repository = $this->objectManager->getRepository($contentRoute->getClassType());
     return $repository->find($contentRoute->getObjectId());
 }
 /**
  * @param ContentRouteInterface $var
  * @return bool
  */
 protected function filterByLocale(ContentRouteInterface $var)
 {
     if ($this->request) {
         return $var->getLocale() == $this->request->getLocale();
     } else {
         return true;
     }
 }
Ejemplo n.º 4
0
 /**
  * @return string
  */
 public function getTemplate()
 {
     if (!$this->contentRoute) {
         return;
     }
     return $this->contentRoute->getTemplate();
 }
Ejemplo n.º 5
0
 /**
  * @param  ContentRouteInterface $contentRoute
  * @return PageSnapshot
  */
 public function setContentRoute(ContentRouteInterface $contentRoute)
 {
     $contentRoute->setClassType(get_class($this));
     $contentRoute->setLocale($this->page->getLocale());
     $contentRoute->setTemplateName($this->page->getTemplateName());
     $this->contentRoute = $contentRoute;
     return $this;
 }