Enhance Template Processing and Cleanup: Updated the ImportHtmlTemplates command to skip additional custom tokens during HTML processing and added a cleanup step to remove leftover tokens from the data array. Improved the TemplateService to replace legacy tokens in HTML, ensuring better template integrity during imports.

This commit is contained in:
Ümit Tunç
2025-12-29 09:39:21 +03:00
parent f4603456b1
commit 9d601cafda
2 changed files with 21 additions and 2 deletions
+8
View File
@@ -318,6 +318,14 @@ class TemplateService
*/
public static function replacePlaceholders(string $html, array $data, ?Model $model = null, array $defaultData = []): string
{
// Legacy/Import artifact fix: Replace ___CUSTOM_...___ tokens if they exist in DB
// These tokens might be leftover from import process if str_replace didn't catch them
$html = str_replace('___SPECIAL_MENU___', '{custom.menu}', $html);
$html = str_replace('___CUSTOM_MENU___', '{custom.menu}', $html);
$html = str_replace('___CUSTOM_NAVBAR___', '{custom.navbar}', $html);
$html = str_replace('___CUSTOM_LANGUAGE___', '{custom.language-selector}', $html);
$html = str_replace('___SETTING_LANGUAGES___', '{custom.language-selector}', $html);
// Handle special {page.content} placeholder - Sayfa/model içeriğini gösterir
if (str_contains($html, '{page.content}')) {
$pageContent = '';