The executePreActions
hook is triggered on Ajax requests that do not require
a DCA object. It passes the name of the action as argument and does not expect
a return value.
string $action
The name of the action.
// src/EventListener/ExecutePreActionsListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
#[AsHook('executePreActions')]
class ExecutePreActionsListener
{
public function __invoke(string $action): void
{
if ('update' === $action) {
// Do something …
}
}
}