function _workbench_email_add_template_selection_field in Workbench Email 8
Same name and namespace in other branches
- 2.x workbench_email.module \_workbench_email_add_template_selection_field()
Attaches the template selection field to a given transition form.
Parameters
array $form: The form array.
array $default_value: A default value for the template checkbox.
2 calls to _workbench_email_add_template_selection_field()
- workbench_email_form_workflow_transition_add_form_alter in ./
workbench_email.module - Implements hook_form_FORM_ID_alter() for workflow_transition_add_form.
- workbench_email_form_workflow_transition_edit_form_alter in ./
workbench_email.module - Implements hook_form_FORM_ID_alter() for workflow_transition_edit_form.
File
- ./
workbench_email.module, line 91 - Provides main module functions.
Code
function _workbench_email_add_template_selection_field(array &$form, $default_value = []) {
// Add the template selection field.
$template_options = array_map(function (TemplateInterface $template) {
return $template
->label();
}, Template::loadMultiple());
$form['workbench_email_templates'] = [
'#type' => 'checkboxes',
'#title' => t('Email Templates'),
'#description' => t('Use the following mail templates'),
'#options' => $template_options,
'#default_value' => $default_value,
'#access' => $template_options,
];
}