Skip to content

Commit

Permalink
[TASK] Add getView and getRequest to event
Browse files Browse the repository at this point in the history
Add more methods to the event FormControllerFormActionEvent.
It is now possible to also retrieve the view and request from
this event. This makes it possible to - for example - add
variables to the view.
  • Loading branch information
sypets committed Oct 17, 2024
1 parent 95c948b commit c6a766e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Classes/Controller/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
use In2code\Powermail\Utility\ObjectUtility;
use In2code\Powermail\Utility\SessionUtility;
use In2code\Powermail\Utility\TemplateUtility;
use TYPO3\CMS\Extbase\Mvc\RequestInterface;
use TYPO3Fluid\Fluid\View\ViewInterface;
use function in_array;
use Psr\Http\Message\ResponseInterface;
use Throwable;
Expand Down Expand Up @@ -64,6 +66,16 @@ class FormController extends AbstractController
*/
protected DataProcessorRunner $dataProcessorRunner;

public function getView(): ?ViewInterface
{
return $this->view;
}

public function getRequest(): ?RequestInterface
{
return $this->request;
}

/**
* @return ResponseInterface
* @noinspection PhpUnused
Expand Down
12 changes: 12 additions & 0 deletions Classes/Events/FormControllerFormActionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

use In2code\Powermail\Controller\FormController;
use In2code\Powermail\Domain\Model\Form;
use TYPO3\CMS\Extbase\Mvc\RequestInterface;
use TYPO3Fluid\Fluid\View\ViewInterface;

final class FormControllerFormActionEvent
{
Expand Down Expand Up @@ -53,4 +55,14 @@ public function getFormController(): FormController
{
return $this->formController;
}

public function getView(): ?ViewInterface
{
return $this->getFormController()->getView();
}

public function getRequest(): ?RequestInterface
{
return $this->getFormController()->getRequest();
}
}

0 comments on commit c6a766e

Please sign in to comment.