/**
  * Sets the view
  * @param \ride\web\cms\orm\ContentProperties $properties
  * @param \ride\library\cms\content\Content $content
  * @return \ride\library\mvc\view\View
  */
 protected function setView(ContentProperties $contentProperties, $content)
 {
     $template = $this->getTemplate(static::TEMPLATE_NAMESPACE . '/default');
     $variables = array('locale' => $this->locale, 'widgetId' => $this->id, 'content' => $content, 'properties' => $contentProperties);
     $view = $this->setTemplateView($template, $variables);
     $viewProcessor = $contentProperties->getViewProcessor();
     if ($viewProcessor) {
         $viewProcessor = $this->dependencyInjector->get('ride\\web\\cms\\orm\\processor\\ViewProcessor', $viewProcessor);
         $viewProcessor->processView($view);
     }
     return $view;
 }
 /**
  * Gets the view
  * @param array $result
  * @param \ride\web\cms\orm\ContentProperties $properties
  * @param \ride\library\form\view\FormView|null $searchForm
  * @param integer $numRows
  * @param integer $pages
  * @param integer $page
  * @param array $arguments
  * @return \ride\library\mvc\view\View
  */
 private function setView(ContentProperties $contentProperties, array $result, $searchForm, $numRows, $pages = 1, $page = 1, array $arguments = array())
 {
     $pagination = null;
     if ($contentProperties->willShowPagination()) {
         $query = null;
         $paginationUrl = $this->request->getUrl();
         if (strpos($paginationUrl, '?') !== false) {
             list($paginationUrl, $query) = explode('?', $paginationUrl, 2);
         }
         $query = preg_replace('((\\?)?' . self::PARAM_PAGE . '=([0-9])*(&)?)', '', $query);
         $paginationUrl .= '?' . self::PARAM_PAGE . '=' . '%page%';
         if ($query) {
             $paginationUrl .= '&' . $query;
         }
         $pagination = new Pagination($pages, $page);
         $pagination->setHref($paginationUrl);
     }
     $moreUrl = null;
     if ($contentProperties->willShowMoreLink()) {
         $nodeModel = $this->dependencyInjector->get('ride\\library\\cms\\node\\NodeModel');
         $selfNode = $this->properties->getNode();
         try {
             $node = $nodeModel->getNode($selfNode->getRootNodeId(), $selfNode->getRevision(), $contentProperties->getMoreNode());
             $moreUrl = $this->request->getBaseScript() . $node->getRoute($this->locale);
         } catch (NodeNotFoundException $exception) {
         }
     }
     $filterUrl = str_replace($this->request->getQuery(), '', $this->request->getUrl());
     foreach ($this->filters as $filterName => $filter) {
         $filter['filter']->setVariables($this->filters, $this->model, $filterName, $this->locale, $filterUrl);
     }
     $this->setContext('orm.overview.' . $this->id, $result);
     $this->setContext('orm.filters.' . $this->id, $this->filters);
     $this->setContext('orm.filters.' . $this->id . '.url', $filterUrl);
     $this->setContext('orm.search.' . $this->id, $searchForm);
     $this->setContext('orm.num.rows.' . $this->id, $numRows);
     $template = $this->getTemplate(static::TEMPLATE_NAMESPACE . '/block');
     $variables = array('locale' => $this->locale, 'widgetId' => $this->id, 'result' => $result, 'numRows' => $numRows, 'properties' => $contentProperties, 'title' => $contentProperties->getTitle(), 'emptyResultMessage' => $contentProperties->getEmptyResultMessage(), 'filterUrl' => $filterUrl, 'filters' => $this->filters, 'searchForm' => $searchForm, 'arguments' => $arguments, 'pagination' => $pagination, 'moreUrl' => $moreUrl, 'moreLabel' => $contentProperties->getMoreLabel());
     $view = $this->setTemplateView($template, $variables);
     $viewProcessor = $contentProperties->getViewProcessor();
     if ($viewProcessor) {
         $viewProcessor = $this->dependencyInjector->get('ride\\web\\cms\\orm\\processor\\ViewProcessor', $viewProcessor);
         $viewProcessor->processView($view);
     }
     return $view;
 }