You are here

function classified_notifications_admin_settings in Classified Ads 6.3

Same name and namespace in other branches
  1. 7.3 modules/classified_notifications/classified_notifications.admin.inc \classified_notifications_admin_settings()

Implements the former hook_settings().

1 string reference to 'classified_notifications_admin_settings'
classified_notifications_menu in modules/classified_notifications/classified_notifications.module
Implements hook_menu().

File

modules/classified_notifications/classified_notifications.admin.inc, line 33
Admin page(s) for the classified module.

Code

function classified_notifications_admin_settings() {

  // Notifications section
  $tokens = token_get_list('all');
  $tokens = array_merge($tokens['user'], $tokens['global']);
  $token_names = array();
  foreach (array_keys($tokens) as $token) {
    $token_names[] = '[' . $token . ']';
  }
  $tokens_description = t("Available tokens: @tokens. Note that [ads] is context-dependent.", array(
    '@tokens' => implode(' ', $token_names),
  ));
  $sections = array(
    'half-life' => t('Half-life'),
    'pre-expire' => t('Pre-expiration'),
    'expire' => t('Expiration'),
    'pre-purge' => t('Pre-purge'),
    'purge' => t('Purge'),
  );
  $weight = -count($sections);
  foreach ($sections as $name => $title) {
    $wrapper = $name . '-wrapper';
    $form[$wrapper] = array(
      '#type' => 'fieldset',
      '#title' => $title,
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => $weight++,
      '#description' => $tokens_description,
    );
    $form[$wrapper]['classified-notifications-' . $name . '-subject'] = array(
      '#type' => 'textfield',
      '#title' => t('Subject'),
      '#default_value' => _classified_get('notifications-' . $name . '-subject'),
    );
    $form[$wrapper]['classified-notifications-' . $name . '-body'] = array(
      '#type' => 'textarea',
      '#title' => t('Body'),
      '#default_value' => _classified_get('notifications-' . $name . '-body'),
    );
  }
  return system_settings_form($form);
}