executePreActions

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.

Parameters

  1. string $action

    The name of the action.

Example

// src/EventListener/ExecutePreActionsListener.php
namespace App\EventListener;

use Contao\CoreBundle\ServiceAnnotation\Hook;
use Terminal42\ServiceAnnotationBundle\ServiceAnnotationInterface;

class ExecutePreActionsListener implements ServiceAnnotationInterface
{
    /**
     * @Hook("executePreActions")
     */
    public function onExecutePreActions(string $action): void
    {
        if ('update' === $action) {
            // Do something …
        }
    }
}

References