loadDataContainer

The loadDataContainer hook is triggered when a DCA file is loaded. It passes the file name as argument and does not expect a return value.

primary:: Available

from Contao 2.8.2.

Parameters

  1. string $table

    Name of the data container to be loaded (e.g. tl_content).

Example

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

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

class LoadDataContainerListener implements ServiceAnnotationInterface
{
    /**
     * @Hook("loadDataContainer")
     */
    public function onLoadDataContainer(string $table): void
    {
        // Do something …
    }
}

References