function workbench_email_create_form_element in Workbench Email 7.3
Same name and namespace in other branches
- 7 workbench_email.module \workbench_email_create_form_element()
Create the email selection form element.
Creates the appropriate multi select list for a given role and stores some email transition information into the form element.
Parameters
array $form: The form array passed by reference
array $settings: The array of additional settings
1 call to workbench_email_create_form_element()
File
- ./
workbench_email.form.inc, line 232 - Code for the Workbench Email Module.
Code
function workbench_email_create_form_element(&$form, $settings) {
$email_transition = $settings['email_transition'];
$emails = $settings['emails'];
$author = $settings['author'];
$editors = $settings['editors'];
$users = $settings['users'];
if ($author) {
$role = workbench_email_get_author_role();
}
else {
$role = user_role_load($email_transition->rid);
if (count($emails) > 1) {
array_unshift($emails, t('-- All Users --'));
}
}
if ($email_transition->rid == WORKBENCH_EMAIL_AUTHOR) {
$description = t('Select the author for notification');
}
else {
$description = t('Select one or more users to notify');
}
$form['options']['#access'] ? $wrapper_id = 'options' : ($wrapper_id = 'revision_information');
$form[$wrapper_id]['workbench_email'][$role->rid] = array(
'#type' => 'select',
'#title' => t("@role_name", array(
'@role_name' => ucwords($role->name),
)),
'#options' => $emails,
'#description' => $description,
'#multiple' => TRUE,
'#hidden' => $email_transition,
);
$user_groups = array(
'editors' => $editors,
'users' => $users,
);
drupal_alter('workbench_email_create_form_element', $form, $email_transition, $user_groups);
}