You are here

function messaging_admin_method_settings in Messaging 7

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. 6.3 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 71
Messaging Framework - Admin UI

Code

function messaging_admin_method_settings() {

  // Sending methods settings
  if ($info = messaging_method_info()) {
    $form['methods'] = array(
      '#theme' => 'messaging_admin_settings_table',
    );
    foreach ($info as $method => $options) {
      $send_method = messaging_send_method($method);
      $options += array(
        'log' => 0,
        'queue' => 0,
      );
      $key = 'messaging_method_' . $method;

      // This will preserve settings for disabled modules
      $form['methods'][$key]['#tree'] = TRUE;
      $form['methods'][$key]['title'] = array(
        '#title' => t('Method'),
        '#markup' => $send_method
          ->get_title(),
      );

      // Display name
      $form['methods'][$key]['name'] = array(
        '#title' => t('Name'),
        '#type' => 'textfield',
        '#default_value' => $send_method
          ->get_name(),
        '#size' => 20,
      );

      // Log and queue can be enabled by 'Messaging Tool', disabled otherwise
      $form['methods'][$key]['queue'] = array(
        '#type' => 'value',
        '#value' => 0,
      );
      $form['methods'][$key]['log'] = array(
        '#type' => 'value',
        '#value' => 0,
      );
    }
  }
  else {
    $form['warning']['#markup'] = t('You should enable some messaging method plug-ins for this to work.');
  }
  $form = system_settings_form($form);

  // Refresh strings after update if translation enabled
  if (module_exists('i18nstrings')) {
    $form['#submit'][] = 'messaging_locale_refresh';
  }
  return $form;
}