Architecture & Data Placeholders
This guide details the internal rendering engine (templates/render.blade.php), data resolution pipeline, and developer usage of data placeholders.
Target Audience & Developer Note
:::important Developer-Oriented Tooling Although the Template Designer presents a visual UI that generates JSON on the client side, it is intended for Developers.
End-users generally do not know the underlying database schemas, Controller data structures, or mapped variable paths (e.g., user.name_en, position.name, date.signed_at). Developers design templates by binding specific placeholder keys matching the Controller's data mapping (unless an attribute dictionary is exposed in the future).
:::
System Architecture
The template system uses a strict separation between visual layout JSON (provided by Firebase) and runtime database data (provided by the Controller).
How Data Placeholders Work (data_get)
The rendering engine evaluates placeholders using Laravel's data_get($data, $field) helper:
$field = $el['dataField'] ?? $el['expr'] ?? '';
$val = data_get($data ?? [], $field, null);
Dot-Notation Mapping Matrix
Placeholder (dataField) | Controller Array Key Path | Example Output Value |
|---|---|---|
user.name | $data['user']['name'] | 张三 |
user.name_en | $data['user']['name_en'] | Zhang San |
position.name | $data['position']['name'] | 副团长 |
date.today | $data['date']['today'] | 2026-08-24 |
date.start_date | $data['date']['start_date'] | 2026年1月1日 |
Adding Custom Data to Templates
To introduce new fields from other models (e.g., Public Event Registrations), add them to the $data array inside the respective Controller:
$data['event'] = [
'title' => $eventRegistration->title ?? '',
'date' => $eventRegistration->event_date ?? '',
];
Now, binding event.title in the Template Designer will resolve automatically.