Add Menu Template functionality: Created MenuTemplate resource with CRUD pages, schemas, and table configuration. Implemented localization for menu template fields and integrated menu rendering capabilities. Enhanced TemplatePreviewController to support menu templates and updated dynamic template documentation accordingly.

This commit is contained in:
Ümit Tunç
2025-11-03 15:43:47 -03:00
parent 9629652d0a
commit 4a2a66c55c
18 changed files with 768 additions and 1 deletions
+7
View File
@@ -267,9 +267,16 @@ class TemplateService
/**
* Replace placeholders in HTML with actual data
* Supports both {text.title} and {{text.title}} formats
* Also supports {menu} placeholder for menu rendering
*/
public static function replacePlaceholders(string $html, array $data): string
{
// Handle special {menu} placeholder first
if (str_contains($html, '{menu}')) {
$renderedMenu = \App\Services\MenuService::render();
$html = str_replace('{menu}', $renderedMenu, $html);
}
// First, parse all placeholders in the format {type.field_name}
preg_match_all('/\{([a-z]+\.[a-z_]+)\}/i', $html, $matches);
$placeholders = array_unique($matches[1] ?? []);