Feature: Introduce ModifyJobControllerNewActionViewEvent in JobController::newAction()
Description
Job dispatches now the newly introduced PSR-14 event
\FGTCLB\ providing
following methods:
function getto extbase controller action plugin context data, which can be used to make decisions using the event.Plugin Controller Action Context (): Plugin Controller Action Acontext function getto retrieve the view instance, which can be used to assign additional data, but disallowing to replace the instance.View (): Fluid View Interface |Core View Interface
Impact
Implementing a event listener for this event allows attaching additional
variables to the view for the Job, for example
to provide additional select field options in case fields are changed,
from text to a select field for example and avoid the need to implement
a custom ViewHelper to retrieve the "select options" within the modified
views.
Example event listener
EXT:my_ext/Classes/EventListener/ModifyJobControllerNewActionViewListener.php
<?php
declare(strict_types=1);
namespace MyVendor\MyExt\EventListener;
use FGTCLB\AcademicJobs\Event\ModifyJobControllerNewActionViewEvent;
use TYPO3\CMS\Fluid\View\FluidViewInterface;
final class ModifyJobControllerNewActionViewListener
{
public function __invoke(ModifyJobControllerNewActionViewEvent $event): void
{
$view = $event->getView();
if ($view instanceof FluidViewInterface) {
// Assign additional variable to the view
$view->assign('myCustomVariable', 'My Custom Value');
}
}
}
Copied!