Skip to content

Commit

Permalink
Tag the glossary items within GeneratePageListener (see #47)
Browse files Browse the repository at this point in the history
* Fix: Add cache invalidation for config json in page body 15976ef
  • Loading branch information
zoglo authored Sep 19, 2024
2 parents bfc0dff + 15976ef commit 6bd3b72
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/EventListener/GeneratePageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ public function __invoke(PageModel $pageModel, LayoutModel $layoutModel, PageReg

$objTemplate->glossaryConfig = $glossaryConfig;

// Tag glossary items
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
$responseTagger->addTags(array_map(static fn ($id) => 'contao.db.tl_glossary_item.'.$id, array_column($arrGlossaryItems, 'id')));
}

$GLOBALS['TL_BODY'][] = $objTemplate->parse();
}
}

0 comments on commit 6bd3b72

Please sign in to comment.