You are here

function mail_debugger_callback in Mail Debugger 7

Same name and namespace in other branches
  1. 7.3 includes/mail_debugger.callback.inc \mail_debugger_callback()
  2. 7.2 includes/mail_debugger.callback.inc \mail_debugger_callback()

Callback for drupal_get_form

_state

Parameters

array $form:

Return value

array

1 string reference to 'mail_debugger_callback'
mail_debugger_menu in ./mail_debugger.module
Implement hook_menu()

File

includes/mail_debugger.callback.inc, line 39

Code

function mail_debugger_callback($form, &$form_state) {
  return array(
    '#tree' => TRUE,
    'tab_group' => array(
      '#type' => 'vertical_tabs',
      '#default_tab' => user_variable_get('mail_debugger_default_tab'),
    ),
    'user' => array(
      '#type' => 'fieldset',
      '#title' => t('User'),
      '#group' => 'tab_group',
      'uid' => array(
        '#type' => 'select',
        '#title' => t('User'),
        '#options' => _mail_debugger_load_users(),
        '#default_value' => user_variable_get('mail_debugger_user_uid'),
      ),
      'type' => array(
        '#type' => 'select',
        '#title' => t('Message'),
        '#options' => array(
          'register_admin_created' => t('Welcome message for user created by the admin.'),
          'register_no_approval_required' => t('Welcome message when user self-registers.'),
          'register_pending_approval' => t('Welcome message, user pending admin approval.'),
          'status_activated' => t('Account activated.'),
          'status_blocked' => t('Account blocked.'),
          'password_reset' => t('Password recovery request.'),
          'cancel_confirm' => t('Account cancellation request.'),
          'status_canceled' => t('Account canceled.'),
        ),
        '#default_value' => user_variable_get('mail_debugger_user_type'),
      ),
      'submit' => array(
        '#type' => 'submit',
        '#name' => 'user_mail',
        '#value' => t('Send mail'),
        '#submit' => array(
          'mail_debugger_callback_submit_user_mail',
          'mail_debugger_callback_submit',
        ),
      ),
    ),
    'custom' => array(
      '#type' => 'fieldset',
      '#title' => t('Custom mail'),
      '#group' => 'tab_group',
      '#collapsed' => TRUE,
      'to' => array(
        '#type' => 'textfield',
        '#title' => t('To'),
        '#default_value' => user_variable_get('mail_debugger_custom_to'),
      ),
      'subject' => array(
        '#type' => 'textfield',
        '#title' => t('Subject'),
        '#default_value' => user_variable_get('mail_debugger_custom_subject'),
      ),
      'body' => array(
        '#type' => 'textarea',
        '#title' => t('Message'),
        '#default_value' => user_variable_get('mail_debugger_custom_body'),
      ),
      'submit' => array(
        '#type' => 'submit',
        '#name' => 'custom_mail',
        '#value' => t('Send mail'),
        '#submit' => array(
          'mail_debugger_callback_submit_custom_mail',
          'mail_debugger_callback_submit',
        ),
        '#validate' => array(
          'mail_debugger_callback_valid_custom_mail',
        ),
      ),
    ),
  );
}