getArticle
Details
This page shows version 4.x. The current version can be found here.
The getArticle hook allows you to override the configuration of an article
prior to rendering. It does not expect a return value.
Parameters
\Contao\ArticleModel
$articleThe database result from table
tl_article.
Example
// 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 …
}
}