/** * Gets the view * @param array $result * @param joppa\content\model\ContentProperties $properties * @param integer $pages * @param integer $page * @return joppa\content\view\ContentView */ private function getView(array $result, ContentProperties $contentProperties, $pages = 1, $page = 1) { $view = $contentProperties->getView(); $listViews = ContentViewFactory::getInstance()->getOverviewViews(); if (!array_key_exists($view, $listViews)) { return null; } $viewClass = $listViews[$view]; $paginationProperties = null; if ($contentProperties->willShowPagination() && $pages > 1) { $paginationUrl = $this->request->getBasePath() . Request::QUERY_SEPARATOR . self::ACTION_PAGE . Request::QUERY_SEPARATOR . '%page%'; $paginationProperties = new PaginationProperties($paginationUrl, $pages, $page); } $moreUrl = null; if ($contentProperties->willShowMoreLink()) { $node = $this->models[NodeModel::NAME]->getNode($contentProperties->getMoreNode(), 0, $this->locale); $moreUrl = $this->request->getBaseUrl() . Request::QUERY_SEPARATOR . $node->getRoute(); } $objectFactory = new ObjectFactory(); $view = $objectFactory->create($viewClass, ContentViewFactory::INTERFACE_OVERVIEW); $view->setContent($this->properties->getWidgetId(), $result, $contentProperties, $paginationProperties, $moreUrl); return $view; }