/** * Checks if the news pid could be found in the startingpoint settings of the detail plugin and * if the pid could not be found it return NULL instead of the news object. * * @param \GeorgRinger\News\Domain\Model\News $news * @return NULL|\GeorgRinger\News\Domain\Model\News */ protected function checkPidOfNewsRecord(\GeorgRinger\News\Domain\Model\News $news) { $allowedStoragePages = GeneralUtility::trimExplode(',', Page::extendPidListByChildren($this->settings['startingpoint'], $this->settings['recursive']), true); if (count($allowedStoragePages) > 0 && !in_array($news->getPid(), $allowedStoragePages)) { $this->signalSlotDispatcher->dispatch(__CLASS__, 'checkPidOfNewsRecordFailedInDetailAction', ['news' => $news, 'newsController' => $this]); $news = null; } return $news; }
/** * Create the demand object which define which records will get shown * * @param \GeorgRinger\News\Domain\Model\Dto\AdministrationDemand $demand * @return \GeorgRinger\News\Domain\Model\Dto\NewsDemand */ protected function createDemandObjectFromSettings(\GeorgRinger\News\Domain\Model\Dto\AdministrationDemand $demand) { $demand->setCategories($demand->getSelectedCategories()); $demand->setOrder($demand->getSortingField() . ' ' . $demand->getSortingDirection()); $demand->setStoragePage(Page::extendPidListByChildren($this->pageUid, (int) $demand->getRecursive())); $demand->setOrderByAllowed($this->settings['orderByAllowed']); if ($demand->getSearchWord()) { $searchDto = new Search(); $searchDto->setSubject($demand->getSearchWord()); $searchDto->setFields('title'); $demand->setSearch($searchDto); } // Ensure that always a storage page is set if ((int) $demand->getStoragePage() === 0) { $demand->setStoragePage('-3'); } return $demand; }
/** * Single view of a news event record * * @param Event $event * @param integer $currentPage current page for optional pagination * @return void */ public function eventDetailAction(Event $event = null, $currentPage = 1) { $this->settings = $this->initializeSettings($this->settings); if (is_null($event)) { if ((int) $this->settings['singleNews'] > 0) { $previewNewsId = $this->settings['singleNews']; } elseif ($this->request->hasArgument('news_preview')) { $previewNewsId = $this->request->getArgument('news_preview'); } else { $previewNewsId = $this->request->getArgument('news'); } if ($this->settings['previewHiddenRecords']) { $event = $this->eventRepository->findByUid($previewNewsId, false); } else { $event = $this->eventRepository->findByUid($previewNewsId); } } if (is_null($event) && isset($this->settings['detail']['errorHandling'])) { $this->handleNoNewsFoundError($this->settings['detail']['errorHandling']); } $this->view->assignMultiple(array('newsItem' => $event, 'currentPage' => (int) $currentPage)); \GeorgRinger\News\Utility\Page::setRegisterProperties($this->settings['detail']['registerProperties'], $event); if ($event instanceof Event) { \GeorgRinger\News\Utility\Cache::addCacheTagsByNewsRecords(array($event)); } }