diff --git a/Classes/Controller/NewsController.php b/Classes/Controller/NewsController.php index c3415eb38a..dcb9699317 100644 --- a/Classes/Controller/NewsController.php +++ b/Classes/Controller/NewsController.php @@ -11,6 +11,7 @@ use GeorgRinger\News\Event\NewsCheckPidOfNewsRecordFailedInDetailActionEvent; use GeorgRinger\News\Event\NewsDateMenuActionEvent; use GeorgRinger\News\Event\NewsDetailActionEvent; +use GeorgRinger\News\Event\NewsInitializeActionEvent; use GeorgRinger\News\Event\NewsListActionEvent; use GeorgRinger\News\Event\NewsListSelectedActionEvent; use GeorgRinger\News\Event\NewsSearchFormActionEvent; @@ -26,6 +27,7 @@ use TYPO3\CMS\Core\TypoScript\TypoScriptService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use TYPO3\CMS\Extbase\Mvc\View\ViewInterface; use TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter; use TYPO3\CMS\Extbase\Reflection\ObjectAccess; use TYPO3\CMS\Fluid\View\TemplateView; @@ -116,6 +118,15 @@ public function initializeAction() $cacheTagsSet = true; } } + /** @var NewsInitializeActionEvent $event */ + $event = $this->eventDispatcher->dispatch( + new NewsInitializeActionEvent( + $this, + $this->defaultViewObjectName, + $this->request->getControllerActionName() + ) + ); + $this->defaultViewObjectName = $event->getDefaultViewObjectName(); } /** @@ -711,6 +722,14 @@ public function setView(TemplateView $view): void $this->view = $view; } + /** + * Set for the NewsInitializeActionEvent + */ + public function getView(): ViewInterface + { + return $this->view; + } + /** * @param $paginationClass * @param int $maximumNumberOfLinks diff --git a/Classes/Domain/Model/News.php b/Classes/Domain/Model/News.php index 3517bfdbc4..be4f0a52b7 100644 --- a/Classes/Domain/Model/News.php +++ b/Classes/Domain/Model/News.php @@ -39,14 +39,14 @@ class News extends AbstractEntity protected $l10nParent = 0; /** - * @var DateTime + * @var DateTime|null */ - protected $starttime; + protected $starttime = null; /** - * @var DateTime + * @var DateTime|null */ - protected $endtime; + protected $endtime = null; /** * keep it as string as it should be only used during imports diff --git a/Classes/Event/NewsInitializeActionEvent.php b/Classes/Event/NewsInitializeActionEvent.php new file mode 100644 index 0000000000..94bd182625 --- /dev/null +++ b/Classes/Event/NewsInitializeActionEvent.php @@ -0,0 +1,69 @@ +newsController = $newsController; + $this->defaultViewObjectName = $defaultViewObjectName; + $this->action = $action; + } + + public function getNewsController(): NewsController + { + return $this->newsController; + } + + public function setNewsController(NewsController $newsController): self + { + $this->newsController = $newsController; + + return $this; + } + + public function getDefaultViewObjectName(): string + { + return $this->defaultViewObjectName; + } + + public function setDefaultViewObjectName(string $defaultViewObjectName): self + { + $this->defaultViewObjectName = $defaultViewObjectName; + + return $this; + } + + public function getAction(): string + { + return $this->action; + } + + public function setAction(string $action): self + { + $this->action = $action; + + return $this; + } +} diff --git a/Documentation/Reference/Events/Index.rst b/Documentation/Reference/Events/Index.rst index 91569f4543..25bcefe99c 100644 --- a/Documentation/Reference/Events/Index.rst +++ b/Documentation/Reference/Events/Index.rst @@ -29,6 +29,7 @@ fired. For additional items see column "Access to" in the table below. "NewsListSelectedActionEvent", "NewsController", "getAssignedValues()", "selectedListAction (NewsController::SIGNAL_NEWS_LIST_SELECTED_ACTION)" "NewsSearchFormActionEvent", "NewsController", "getAssignedValues()", "searchFormAction (NewsController::SIGNAL_NEWS_SEARCHFORM_ACTION)" "NewsSearchResultActionEvent", "NewsController", "getAssignedValues()", "searchResultAction (NewsController::SIGNAL_NEWS_SEARCHRESULT_ACTION)" + "NewsInitializeActionEvent", "NewsController", "getDefaultViewObjectName();getAction()", "" "AdministrationIndexActionEvent", "AdministrationController", "getAssignedValues()", "indexAction (AdministrationController::SIGNAL_ADMINISTRATION_INDEX_ACTION)" "AdministrationNewsPidListingActionEvent", "AdministrationController", "getRawTree();getTreeLevel()", "newsPidListingAction (AdministrationController::SIGNAL_ADMINISTRATION_NEWSPIDLISTING_ACTION)" "AdministrationExtendMenuEvent", "AdministrationController", "getMenu()", "createMenu"