You are here

function messaging_admin_settings in Messaging 7

Same name and namespace in other branches
  1. 5 messaging.module \messaging_admin_settings()
  2. 6.4 messaging.admin.inc \messaging_admin_settings()
  3. 6 messaging.admin.inc \messaging_admin_settings()
  4. 6.2 messaging.admin.inc \messaging_admin_settings()
  5. 6.3 messaging.admin.inc \messaging_admin_settings()

Admin settings form

2 string references to 'messaging_admin_settings'
messaging_devel_form_alter in messaging_devel/messaging_devel.module
Implementation of hook_form_alter()
messaging_menu in ./messaging.module
Implementation of hook_menu()

File

./messaging.admin.inc, line 14
Messaging Framework - Admin UI

Code

function messaging_admin_settings() {

  // Get plug-in information and produce big warning if none enabled.
  $method_info = messaging_method_info();
  if (!$method_info) {

    // Get message from requirements
    if ($reqs = messaging_requirements('runtime')) {
      drupal_set_message($reqs['messaging']['value'], 'error');
    }
    $form = array();
  }
  else {
    $form['methods'] = array(
      '#type' => 'fieldset',
      '#title' => t('Sending methods'),
      '#theme' => 'messaging_admin_methods_table',
    );
    $options = $enabled = array();
    foreach ($method_info as $method => $info) {
      $send_method = messaging_send_method($method);
      $options[$method] = '';
      if ($info['enabled']) {
        $enabled[] = $method;
      }
      $form['methods']['name'][$method]['#markup'] = $send_method
        ->get_title();
      $form['methods']['description'][$method]['#markup'] = $send_method
        ->get_description();
    }
    $form['methods']['messaging_method_enabled'] = array(
      '#type' => 'checkboxes',
      '#options' => $options,
      '#default_value' => $enabled,
    );
    $form['methods']['messaging_default_method'] = array(
      '#type' => 'radios',
      '#options' => $options,
      '#default_value' => variable_get('messaging_default_method', ''),
    );
    $form['#validate'][] = 'messaging_admin_settings_validate';
  }

  // We use settings form so other modules can add here their settings
  return system_settings_form($form);
}