You are here

function messaging_admin_settings in Messaging 6.4

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

Admin settings form

1 string reference to 'messaging_admin_settings'
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) {
      $options[$method] = '';
      if ($info['enabled']) {
        $enabled[] = $method;
      }
      $method_names[$method] = $info['title'];
      $form['methods']['name'][$method]['#value'] = $info['title'];
      $form['methods']['description'][$method]['#value'] = $info['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);
}