/** * Loads the properties of the detail widget for the provided site and locale * @param string $index The key to store the values * @param string $site Id of the site * @param string $locale Code of the current locale * @return null */ protected function parseArguments($index, $site, $locale) { $properties = new ContentProperties(); $properties->getFromWidgetProperties($this->properties, $locale); $this->reflectionHelper = $this->model->getReflectionHelper(); $this->arguments[$index] = array(ContentProperties::PROPERTY_RECURSIVE_DEPTH => $properties->getRecursiveDepth(), ContentProperties::PROPERTY_INCLUDE_UNLOCALIZED => $properties->getIncludeUnlocalized(), ContentProperties::PROPERTY_ID_FIELD => $properties->getIdField(), ContentProperties::PROPERTY_FORMAT_TITLE => $properties->getContentTitleFormat(), ContentProperties::PROPERTY_FORMAT_TEASER => $properties->getContentTeaserFormat(), ContentProperties::PROPERTY_FORMAT_IMAGE => $properties->getContentImageFormat(), ContentProperties::PROPERTY_FORMAT_DATE => $properties->getContentDateFormat(), self::PROPERTY_URL => rtrim($this->routerService->getUrl($this->baseScript, 'cms.front.' . $site . '.' . $this->node->getId() . '.' . $locale), '/') . '/'); }
/** * Gets the result from the query * @param \ride\web\cms\orm\ContentProperties $properties * @param \ride\library\orm\query\ModelQuery $query * @return array Array with Content objects */ protected function getResult(ContentProperties $contentProperties, ContentService $contentService, ModelQuery $query) { $entry = $query->queryFirst(); if (!$entry) { return $entry; } $node = $this->properties->getNode(); $titleFormat = $contentProperties->getContentTitleFormat(); $teaserFormat = $contentProperties->getContentTeaserFormat(); $imageFormat = $contentProperties->getContentImageFormat(); $dateFormat = $contentProperties->getContentDateFormat(); return $contentService->getContentForEntry($this->model, $entry, $node->getRootNodeId(), $this->locale, null, $titleFormat, $teaserFormat, $imageFormat, $dateFormat); }
/** * Gets the result from the query * @param \ride\web\cms\orm\ContentProperties $contentProperties * @param \ride\web\cms\orm\ContentService $contentService * @param \ride\library\orm\query\ModelQuery $query * @return array Array with Content objects */ private function getResult(ContentProperties $contentProperties, ContentService $contentService, ModelQuery $query) { $result = $query->query(); if (!$result) { return $result; } $node = $this->properties->getNode(); $contentMapper = $contentProperties->getContentMapper(); $titleFormat = $contentProperties->getContentTitleFormat(); $teaserFormat = $contentProperties->getContentTeaserFormat(); $imageFormat = $contentProperties->getContentImageFormat(); $dateFormat = $contentProperties->getContentDateFormat(); return $contentService->getContentForEntries($this->model, $result, $node->getRootNodeId(), $this->locale, $contentMapper, $titleFormat, $teaserFormat, $imageFormat, $dateFormat); }