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\ServiceAnnotation\Hook;
use Contao\ArticleModel;
/**
* @Hook("getArticle")
*/
class GetArticleListener
{
public function __invoke(ArticleModel $article): void
{
// Modify $article here …
}
}