EmailHtmlTemplates extends AppModel
Email HTML templates
Table of Contents
Methods
| __construct() | Initialize EmailHtmlTemplates |
| add() | Adds a new email HTML template |
| addGroup() | Adds a new email HTML template group |
| delete() | Deletes an existing email HTML template |
| deleteGroup() | Deletes an existing email HTML template group |
| edit() | Updates an existing email HTML template |
| editGroup() | Updates an email HTML template group |
| get() | |
| getGroup() | Fetches an email HTML template group |
| getGroups() | Fetch the email HTML template groups |
| getGroupRules() | Returns the rule set for adding/editing email template groups |
| getRules() | Returns the rule set for adding/editing email templates |
Methods
__construct()
Initialize EmailHtmlTemplates
public
__construct() : mixed
add()
Adds a new email HTML template
public
add(array<string|int, mixed> $vars) : mixed
Parameters
- $vars : array<string|int, mixed>
-
An array including:
- email_template_group_id The ID of the email html group where the template belongs
- lang The language of the template
- html The HTML template
Return values
mixed —The ID of the email HTML template, void on error
addGroup()
Adds a new email HTML template group
public
addGroup(array<string|int, mixed> $vars) : mixed
Parameters
- $vars : array<string|int, mixed>
-
An array including:
- name The name of the group
- company_id The ID of the company where the group belongs
- templates An array of arrays representing the template, each one including:
- lang The language of the template
- html The HTML template
Return values
mixed —The ID of the group, void on error
delete()
Deletes an existing email HTML template
public
delete(int $id) : mixed
Parameters
- $id : int
-
The ID of the email HTML template to delete
deleteGroup()
Deletes an existing email HTML template group
public
deleteGroup(int $id) : mixed
Parameters
- $id : int
-
The ID of the email HTML template group to delete
edit()
Updates an existing email HTML template
public
edit(int $id, array<string|int, mixed> $vars) : mixed
Parameters
- $id : int
- $vars : array<string|int, mixed>
-
An array including:
- email_template_group_id The ID of the email html group where the template belongs
- lang The language of the template
- html The HTML template
Return values
mixed —The ID of the email HTML template, void on error
editGroup()
Updates an email HTML template group
public
editGroup(int $id, array<string|int, mixed> $vars) : mixed
Parameters
- $id : int
-
The ID of the group to update
- $vars : array<string|int, mixed>
-
An array including:
- name The name of the group
- company_id The ID of the company where the group belongs
- templates An array of arrays representing the template, each one including:
- lang The language of the template
- html The HTML template
Return values
mixed —The ID of the group, void on error
get()
public
get(int $id) : mixed
Parameters
- $id : int
getGroup()
Fetches an email HTML template group
public
getGroup(int $id) : mixed
Parameters
- $id : int
-
The ID of the email HTML template group to fetch
Return values
mixed —A stdClass object representing the group and it's templates
getGroups()
Fetch the email HTML template groups
public
getGroups([int $company_id = null ]) : array<string|int, mixed>
Parameters
- $company_id : int = null
-
The ID of the company to fetch the HTML template groups
Return values
array<string|int, mixed> —An array of objects, each one representing the group
getGroupRules()
Returns the rule set for adding/editing email template groups
private
getGroupRules(array<string|int, mixed> $vars[, mixed $edit = false ]) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
-
The input vars
- $edit : mixed = false
Return values
array<string|int, mixed> —The group verification rules
getRules()
Returns the rule set for adding/editing email templates
private
getRules(array<string|int, mixed> $vars[, mixed $edit = false ]) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
-
The input vars
- $edit : mixed = false
Return values
array<string|int, mixed> —The group verification rules