Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Classes/Controller/NewsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
}

/**
Expand Down Expand Up @@ -700,4 +711,9 @@ public function setView(TemplateView $view): void
{
$this->view = $view;
}

public function getView(): ViewInterface
{
return $this->view;
}
}
110 changes: 110 additions & 0 deletions Classes/Event/NewsInitializeActionEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php

Comment thread
AKaravas marked this conversation as resolved.
namespace GeorgRinger\News\Event;

use GeorgRinger\News\Controller\NewsController;

/**
* This file is part of the "news" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
final class NewsInitializeActionEvent
{
/**
* @var NewsController
*/
private $newsController;
Comment thread
AKaravas marked this conversation as resolved.

/**
* @var string
*/
private $defaultViewObjectName;

/**
* @var string
*/
private $action;

public function __construct(NewsController $newsController, string $defaultViewObjectName, string $action = '')
{
$this->newsController = $newsController;
$this->defaultViewObjectName = $defaultViewObjectName;
$this->action = $action;
}

/**
* Get the news controller
Comment thread
AKaravas marked this conversation as resolved.
Outdated
*/
public function getNewsController(): NewsController
{
return $this->newsController;
}

/**
* Set the news controller
*/
public function setNewsController(NewsController $newsController): self
{
$this->newsController = $newsController;

return $this;
}

/**
* Get the assignedValues
*/
public function getAssignedValues(): array
{
return $this->assignedValues;
}

/**
* Set the assignedValues
*/
public function setAssignedValues(array $assignedValues): self
{
$this->assignedValues = $assignedValues;

return $this;
}

/**
* @return string
*/
public function getDefaultViewObjectName(): string
{
return $this->defaultViewObjectName;
}

/**
* @param string $defaultViewObjectName
* @return NewsInitializeActionEvent
*/
public function setDefaultViewObjectName(string $defaultViewObjectName): self
{
$this->defaultViewObjectName = $defaultViewObjectName;

return $this;
}

/**
* @return string
*/
public function getAction(): string
{
return $this->action;
}

/**
* @param string $action
* @return NewsInitializeActionEvent
*/
public function setAction(string $action): self
{
$this->action = $action;

return $this;
}
}
1 change: 1 addition & 0 deletions Documentation/Reference/Events/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down