diff --git a/src/Dravencms/FrontModule/Components/HtmlSnippet/HtmlSnippet/Detail/Detail.php b/src/Dravencms/FrontModule/Components/HtmlSnippet/HtmlSnippet/Detail/Detail.php index fe1b0ba..6cdb158 100644 --- a/src/Dravencms/FrontModule/Components/HtmlSnippet/HtmlSnippet/Detail/Detail.php +++ b/src/Dravencms/FrontModule/Components/HtmlSnippet/HtmlSnippet/Detail/Detail.php @@ -70,15 +70,20 @@ public function render() $key = __CLASS__ . $htmlSnippetTranslation->getId(); $tempFile = $this->tempnam->load($key, $htmlSnippetTranslation->getUpdatedAt()); - + $invalidateLatteCache = false; if ($tempFile === null) { $temp = file_get_contents(__DIR__ . '/detail.latte'); $temp = strtr($temp, ['' => $htmlSnippetTranslation->getHtml()]); $tempFile = $this->tempnam->save($key, $temp, $htmlSnippetTranslation->getUpdatedAt()); + $invalidateLatteCache = true; } $template->setFile($tempFile); + if ($invalidateLatteCache) { + $latteTmpFile = $template->getLatte()->getCacheFile($template->getFile()); + if (is_file($latteTmpFile)) unlink($latteTmpFile); + } $template->render(); } }