You are here

function messaging_admin_method_settings in Messaging 6.3

Same name and namespace in other branches
  1. 6.4 messaging.admin.inc \messaging_admin_method_settings()
  2. 6 messaging.admin.inc \messaging_admin_method_settings()
  3. 6.2 messaging.admin.inc \messaging_admin_method_settings()
  4. 7 messaging.admin.inc \messaging_admin_method_settings()

Default sending methods settings

1 string reference to 'messaging_admin_method_settings'
messaging_menu in ./messaging.module
Implementation of hook_menu()

File

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

Code

function messaging_admin_method_settings() {

  // Sending methods settings
  if ($info = messaging_method_info()) {
    foreach (filter_formats() as $format) {
      $format_options[$format->format] = $format->name;
    }

    // We add this last for it not bo be default
    $format_options[0] = t('None (Insecure)');
    $form['methods'] = array(
      '#theme' => 'messaging_admin_method_settings',
    );
    foreach ($info as $method => $options) {
      $key = 'messaging_method_' . $method;

      // This will preserve settings for disabled modules
      $form['methods'][$key]['#tree'] = TRUE;
      $form['methods'][$key]['title'] = array(
        '#value' => $options['title'],
      );

      // Display name
      $form['methods'][$key]['name'] = array(
        '#type' => 'textfield',
        '#default_value' => $options['name'],
        '#size' => 40,
      );

      // Output filter applied to message body
      $form['methods'][$key]['filter'] = array(
        '#type' => 'select',
        '#default_value' => isset($options['filter']) ? $options['filter'] : variable_get('messaging_default_filter', ''),
        '#options' => $format_options,
      );
    }
  }
  else {
    $form['warning'] = array(
      '#value' => t('You should enable some messaging method plug-ins for this to work.'),
    );
  }
  return system_settings_form($form);
}