Skip to content

Commit c6a766e

Browse files
committed
[TASK] Add getView and getRequest to event
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.
1 parent 95c948b commit c6a766e

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Classes/Controller/FormController.php

+12
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
use In2code\Powermail\Utility\ObjectUtility;
3333
use In2code\Powermail\Utility\SessionUtility;
3434
use In2code\Powermail\Utility\TemplateUtility;
35+
use TYPO3\CMS\Extbase\Mvc\RequestInterface;
36+
use TYPO3Fluid\Fluid\View\ViewInterface;
3537
use function in_array;
3638
use Psr\Http\Message\ResponseInterface;
3739
use Throwable;
@@ -64,6 +66,16 @@ class FormController extends AbstractController
6466
*/
6567
protected DataProcessorRunner $dataProcessorRunner;
6668

69+
public function getView(): ?ViewInterface
70+
{
71+
return $this->view;
72+
}
73+
74+
public function getRequest(): ?RequestInterface
75+
{
76+
return $this->request;
77+
}
78+
6779
/**
6880
* @return ResponseInterface
6981
* @noinspection PhpUnused

Classes/Events/FormControllerFormActionEvent.php

+12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
use In2code\Powermail\Controller\FormController;
77
use In2code\Powermail\Domain\Model\Form;
8+
use TYPO3\CMS\Extbase\Mvc\RequestInterface;
9+
use TYPO3Fluid\Fluid\View\ViewInterface;
810

911
final class FormControllerFormActionEvent
1012
{
@@ -53,4 +55,14 @@ public function getFormController(): FormController
5355
{
5456
return $this->formController;
5557
}
58+
59+
public function getView(): ?ViewInterface
60+
{
61+
return $this->getFormController()->getView();
62+
}
63+
64+
public function getRequest(): ?RequestInterface
65+
{
66+
return $this->getFormController()->getRequest();
67+
}
5668
}

0 commit comments

Comments
 (0)