You are here

function gdpr_tasks_email_settings in General Data Protection Regulation 7

Config form for automated emails for task requests.

1 string reference to 'gdpr_tasks_email_settings'
gdpr_tasks_menu in modules/gdpr_tasks/gdpr_tasks.module
Implements hook_menu().

File

modules/gdpr_tasks/gdpr_tasks.admin.inc, line 265
Administrative page and form callbacks for the GDPR Tasks module.

Code

function gdpr_tasks_email_settings($form, &$form_state) {
  $form['gdpr_tasks_emails'] = array(
    '#tree' => TRUE,
  );
  $form['gdpr_tasks_emails']['emails'] = array(
    '#type' => 'vertical_tabs',
  );
  $emails = variable_get('gdpr_tasks_emails', array());
  $tokens = array(
    'site',
    'gdpr_task',
  );
  $title = t('Request requested (by user)');
  $description = t('This email is sent when a task is requested by a user.');
  $form['gdpr_tasks_emails'] += gdpr_tasks_email_settings_subform('task_requested_self', $title, $description, $emails, $tokens);
  $title = t('Request requested (by staff)');
  $description = t('This email is sent when a task is requested by a staff member or administrator.');
  $form['gdpr_tasks_emails'] += gdpr_tasks_email_settings_subform('task_requested_other', $title, $description, $emails, $tokens);
  $title = t('Task processed');
  $description = t('This email is sent when a task has been prcessed by a staff member or administrator.');
  $form['gdpr_tasks_emails'] += gdpr_tasks_email_settings_subform('task_processed', $title, $description, $emails, $tokens);

  // Make sure anything not exposed is preserved.
  foreach ($emails as $key => $value) {
    if (!isset($form['gdpr_tasks_emails'][$key])) {
      $form['gdpr_tasks_emails'][$key] = array(
        '#type' => 'value',
        '#value' => $value,
      );
    }
  }
  $form['gdpr_tasks_emails_from'] = array(
    '#type' => 'textfield',
    '#title' => t('Email from address'),
    '#description' => t('Leave blank to use the site wide email address.'),
    '#default_value' => variable_get('gdpr_tasks_emails_from', NULL),
  );
  $form['#validate'][] = 'gdpr_tasks_email_settings_validate';
  $form['#submit'][] = 'gdpr_tasks_email_settings_submit';
  return system_settings_form($form);
}