function hook_mail_edit_templates in Mail Editor 8
Same name and namespace in other branches
- 2.0.x mail_edit.api.php \hook_mail_edit_templates()
Define the email templates provided by a module.
Return value
array A nested array. The first level indicates the config keys which store the email templates. Each item within that should be in a 'key' => 'label' structure, but just 'key' will also work. In both cases the 'key' will be used as the array key within the config structure and is expected to be an array with keys named 'subject' and 'body', representing the email's subject and body fields respectively. Note: if these config objects or email values do not exist they can be dynamically created at runtime by editing and saving them. This allows email templates to be defined without necessarily a default value being present for them.
See also
1 function implements hook_mail_edit_templates()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- user_mail_edit_templates in ./
mail_edit.module - Implements hook_mail_edit_keys().
2 invocations of hook_mail_edit_templates()
- MailEditTemplateForm::getTemplate in src/
Form/ MailEditTemplateForm.php - Load an email template from a combination string.
- MailListController::getAllTemplates in src/
Controller/ MailListController.php - Get a list of all templates provided by the site.
File
- ./
mail_edit.api.php, line 25 - Documentation of the hooks provided by Mail Edit.
Code
function hook_mail_edit_templates() {
return [
// Config object name.
'mymodule.emails' => [
// Template name => template label.
'never_gonna_give_you_up' => t('Never gonna give you up'),
'never_gonna_let_you_down' => t('Never gonna let you down'),
'never_gonna_run_around' => t('Never gonna run around'),
'and_desert_you' => t('And desert you'),
// Template name.
'never_gonna_make_you_cry',
'never_gonna_say_goodbye',
'never_gonna_tell_a_lie',
'and_hurt_you',
],
];
}