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.
string $table
Name of the data container to be loaded (e.g. tl_content
).
// src/EventListener/LoadDataContainerListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
#[AsHook('loadDataContainer')]
class LoadDataContainerListener
{
public function __invoke(string $table): void
{
// Do something …
}
}