The parseArticles hook is triggered when parsing news articles. It passes the
front end template, the current article and the news module instance as arguments
and does not expect a return value.
Parameters
\Contao\FrontendTemplate$template
The front end template instance for the news article (e.g. news_full).
array$newsEntry
The current news item database result.
\Contao\Module$module
The module instance (e.g. \Contao\ModuleNewsList).
Example
// src/EventListener/ParseArticlesListener.php
namespaceApp\EventListener;useContao\CoreBundle\DependencyInjection\Attribute\AsHook;useContao\FrontendTemplate;useContao\Module;useContao\UserModel;#[AsHook('parseArticles')]
classParseArticlesListener{publicfunction__invoke(FrontendTemplate$template,array$newsEntry,Module$module):void{// Remove the default "by …" from Contao
$template->author=UserModel::findById($newsEntry['author'])->name;}}