postDownload

The postDownload hook is triggered after a file has been downloaded with the download/downloads content element. It passes the file name as argument and does not expect a return value.

Parameters

  1. string $file

    The file which has been downloaded (relative path from TL_ROOT).

Example

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

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

class PostDownloadListener implements ServiceAnnotationInterface
{
    /**
     * @Hook("postDownload")
     */
    public function onPostDownload(string $file): void
    {
        // Do something …
    }
}

References