The getArticle
hook allows you to override the configuration of an article
prior to rendering. It does not expect a return value.
\Contao\ArticleModel $article
The database result from table tl_article
.
// src/EventListener/GetArticleListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\ArticleModel;
#[AsHook('getArticle')]
class GetArticleListener
{
public function __invoke(ArticleModel $article): void
{
// Modify $article here …
}
}