executePostActions

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.

Parameters

  1. string $action

    The name of the action.

  2. \Contao\DataContainer $dc

    Data container object of the current DCA instance.

Example

// 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 …
        }
    }
}

References