You are here

function workbench_email_notification_submit in Workbench Email 7

Same name and namespace in other branches
  1. 7.3 workbench_email.form.inc \workbench_email_notification_submit()

Submit handler for the workflow_email form element.

Sends emails to the specific users selected in the form element.

Parameters

array $form: The form array

array $form_state: The form_state array

1 string reference to 'workbench_email_notification_submit'
workbench_email_form_node_form_alter in ./workbench_email.module
Implements hook_node_form_alter().

File

./workbench_email.module, line 205
Code for the Workbench Email Module.

Code

function workbench_email_notification_submit($form, &$form_state) {
  if (isset($form_state['values']['workflow_email'])) {
    $form['options']['#access'] ? $wrapper_id = 'options' : ($wrapper_id = 'revision_information');
    foreach ($form_state['values']['workflow_email'] as $rid => $role_emails) {
      foreach ($role_emails as $email) {
        if ($email) {
          $email_transition = $form[$wrapper_id]['workflow_email'][$rid]['#hidden'];
          workbench_email_mail_send($email, $email_transition, $form_state['node']);
        }
      }
    }
  }
}