Constructor
new EmailTemplateFormController()
Methods
_appendVariableRow(entry, shouldFocus)
- Description:
Append one variable contract row.
- Source:
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
entry |
object | ||
shouldFocus |
boolean |
false
|
Whether to focus the new row name input |
_collectVariableContractRows() → {Array.<object>}
- Description:
Collect valid variable contract rows for serialization.
- Source:
Returns:
- Type
- Array.<object>
_extractPlaceholders(content) → {Array.<string>}
- Description:
Extract unique placeholder names from a template string. Matches {{varName}} and {{#if varName}} / {{/if}} / {{else}} patterns. Returns names sorted alphabetically, excluding control keywords.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string |
Returns:
- Type
- Array.<string>
_humanizeVariableName(name) → {string}
- Description:
Create a readable default description from a variable name.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | Variable name |
Returns:
- Type
- string
_normalizeSchemaEntries(entries) → {Array.<object>}
- Description:
Normalize supported schema shapes into row entries.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
Array.<object> | object |
Returns:
- Type
- Array.<object>
_readVariableSchema() → {Array.<object>}
- Description:
Parse the hidden JSON schema field.
- Source:
Returns:
- Type
- Array.<object>
_refreshParsedPlaceholders()
- Description:
Parse {{varName}} placeholders from the HTML and text template fields and display them as a helper in the Variables Contract tab.
- Source:
_refreshVariableRowsState()
- Description:
Toggle empty-state messaging.
- Source:
_renderVariableContractRows(entries)
- Description:
Render schema entries into editor rows.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
Array.<object> |
_schemaHasVariable(name) → {boolean}
- Description:
Check whether the row editor already has a variable.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | Variable name |
Returns:
- Type
- boolean
_slugify(text) → {string}
- Description:
Convert an arbitrary string to a valid slug (lowercase, hyphens).
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string |
Returns:
- Type
- string
addVariable()
- Description:
Add a blank variable contract row.
- Source:
addVariableFromPlaceholder(name)
- Description:
Add a detected placeholder to the variable contract.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | Placeholder name |
nameChanged()
- Description:
Called on name field input. Auto-fills slug if slug is currently empty.
- Source:
removeVariable(event)
- Description:
Remove a variable contract row.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
event |
Event |
serializeVariableContract()
- Description:
Serialize the row editor into the backend JSON field.
- Source:
templateChanged()
- Description:
Called when html_template or text_template content changes. Refreshes the parsed-placeholders helper in the Variables Contract tab.
- Source:
variableContractChanged()
- Description:
Keep the hidden JSON field up to date as rows are edited.
- Source: