Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function resolve(array $parameter, RequestAnalyzerInterface $requestAnalyzer = null, StructureInterface $structure = null, $preview = false)
 {
     if ($structure !== null) {
         $structureData = $this->structureResolver->resolve($structure);
     } else {
         $structureData = [];
     }
     if (!$preview) {
         $requestAnalyzerData = $this->requestAnalyzerResolver->resolve($requestAnalyzer);
     } else {
         $requestAnalyzerData = $this->requestAnalyzerResolver->resolveForPreview($structure->getWebspaceKey(), $structure->getLanguageCode());
     }
     if (null !== ($portal = $requestAnalyzer->getPortal())) {
         $allLocalizations = $portal->getLocalizations();
     } else {
         $allLocalizations = $requestAnalyzer->getWebspace()->getLocalizations();
     }
     $pageUrls = array_key_exists('urls', $structureData) ? $structureData['urls'] : [];
     $urls = [];
     foreach ($allLocalizations as $localization) {
         /* @var Localization $localization */
         $locale = $localization->getLocalization();
         if (array_key_exists($locale, $pageUrls)) {
             $urls[$locale] = $pageUrls[$locale];
         } else {
             $urls[$locale] = '/';
         }
     }
     $structureData['urls'] = $urls;
     return array_merge($parameter, $structureData, $requestAnalyzerData);
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function resolve($customParameters = [])
 {
     $parameters = array_merge($this->getDefaultParameters(), $this->requestAnalyzerResolver->resolve($this->requestAnalyzer));
     // Generate Urls
     if (!isset($customParameters['urls'])) {
         $customParameters['urls'] = $this->getUrls();
     }
     return array_merge($parameters, $customParameters);
 }
 /**
  *
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function detailAction(Request $request)
 {
     $event = $this->eventManager->findByIdAndLocale($request->get('id'), 'de', true);
     if (!$event) {
         throw new NotFoundHttpException(404);
     }
     $filter['lat'] = $event->getLatitude();
     $filter['long'] = $event->getLongitude();
     $filter['area'] = 100;
     $requestData = $this->requestAnalyzerResolver->resolve($this->requestAnalyzer);
     $resolverData = $this->parameterResolver->resolve(array(), $this->requestAnalyzer, null, false);
     $response = $this->templating->renderResponse('SuluEventBundle:templates:detail.html.twig', array_merge(array('event' => $event, 'urls' => isset($resolverData['urls']) ? $resolverData['urls'] : array()), $requestData));
     $response->setMaxAge($this->cacheMaxAge);
     $response->setSharedMaxAge($this->cacheSharedMaxAge);
     return $response;
 }