/** * Action responsible for rendering search, map and list partial * * @param Model\Constraint $search * * @throws \BadFunctionCallException * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception * @return void * @validate $search Evoweb.StoreFinder:Constraint */ public function mapAction(Model\Constraint $search = null) { $afterSearch = 0; if ($search !== null) { $afterSearch = 1; $search = $this->geocodeService->geocodeAddress($search); $locations = $this->locationRepository->findByConstraint($search); $result = $this->signalSlotDispatcher->dispatch(__CLASS__, 'mapActionWithConstraint', array($search, $locations, $this)); /** @var Model\Constraint $search */ $search = $result[0]; /** @var QueryResultInterface $locations */ $locations = $result[1]; $center = $this->getCenter($search); $center = $this->setZoomLevel($center, $search); $this->view->assign('center', $center); $this->view->assign('numberOfLocations', $locations->count()); $this->view->assign('locations', $locations); } elseif ($this->settings['singleLocationId']) { /** @var Model\Constraint $search */ $search = $this->objectManager->get(\Evoweb\StoreFinder\Domain\Model\Constraint::class); $center = $this->getCenter($search); $center = $this->setZoomLevel($center, $search); $this->view->assign('center', $center); $location = $this->locationRepository->findByUid((int) $this->settings['singleLocationId']); $this->view->assign('numberOfLocations', is_object($location) ? 1 : 0); $this->view->assign('locations', array($location)); } else { /** @var Model\Constraint $search */ $search = $this->objectManager->get(\Evoweb\StoreFinder\Domain\Model\Constraint::class); if ($this->settings['showBeforeSearch'] & 2 && is_array($this->settings['defaultConstraint'])) { $search = $this->addDefaultConstraint($search); $search = $this->geocodeService->geocodeAddress($search); $center = $this->getCenter($search); $center = $this->setZoomLevel($center, $search); $this->view->assign('center', $center); if ($this->settings['showLocationsForDefaultConstraint']) { $locations = $this->locationRepository->findByConstraint($search); $this->view->assign('numberOfLocations', $locations->count()); $this->view->assign('locations', $locations); } } if ($this->settings['showBeforeSearch'] & 4) { $this->locationRepository->setDefaultOrderings(array('zipcode' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'city' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'name' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING)); $locations = $this->locationRepository->findAll(); $this->view->assign('locations', $locations); } } $this->addCategoryFilterToView(); $this->view->assign('afterSearch', $afterSearch); $this->view->assign('search', $search); $this->view->assign('static_info_tables', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables') ? 1 : 0); }