Generates legal page content from EEx templates.
Templates are loaded from:
- Parent application's
priv/legal_templates/(for customization) - PhoenixKit's bundled templates in
priv/legal_templates/
Template Variables
All templates receive these variables:
@company_name- Company name@company_address- Company address@company_country- Company country@company_website- Company website URL@registration_number- Company registration number@vat_number- VAT number@dpo_name- Data Protection Officer name@dpo_email- DPO email@dpo_phone- DPO phone@dpo_address- DPO address@frameworks- List of selected framework IDs@effective_date- Current date in ISO format
Usage
context = %{
company_name: "Acme Corp",
company_address: "123 Main St",
effective_date: "2025-01-15"
}
{:ok, content} = TemplateGenerator.render("privacy_policy.eex", context)
Summary
Functions
Get the full path to a template file.
List all available templates.
Render a template with the given context.
Check if a template exists.
Functions
Get the full path to a template file.
Checks parent application first, then falls back to PhoenixKit templates.
@spec list_available_templates() :: [String.t()]
List all available templates.
Render a template with the given context.
Parameters
template_name- Template filename (e.g., "privacy_policy.eex")context- Map of variables to pass to the template
Returns
{:ok, content}- Rendered content{:error, reason}- Error reason
Check if a template exists.