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