You are here

function _jammer_messages_settings in Jammer 6

Same name and namespace in other branches
  1. 7 jammer_messages.module \_jammer_messages_settings()
1 string reference to '_jammer_messages_settings'
jammer_messages_menu in ./jammer_messages.module
Implements hook_menu().

File

./jammer_messages.module, line 66
Filter status messages set by drupal_set_message().

Code

function _jammer_messages_settings() {
  $form = array();
  $form['jammer_messages_string'] = array(
    '#type' => 'textfield',
    '#title' => t('Message to jam'),
    '#required' => TRUE,
    '#description' => t('The message format is processed in regular expression form. Enter either an exact string to suppress, ' . 'or one which matches !PCRE formatting.', array(
      '!PCRE' => l('PCRE', 'http://us3.php.net/manual/en/book.pcre.php', array(
        'external' => TRUE,
      )),
    )),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Jam message',
  );
  $current_settings = db_query("SELECT mid, message_string FROM {jammer_messages}");
  $headers = array(
    t('Message Pattern ID'),
    t('Message Pattern'),
    t('Delete'),
  );
  $data = array();
  while ($setting = db_fetch_object($current_settings)) {
    $data[] = array(
      $setting->mid,
      $setting->message_string,
      l(t('Delete'), 'admin/settings/jammer/jammer_messages/delete/' . $setting->mid),
    );
  }
  if (!empty($data)) {
    $form['configured'] = array(
      '#type' => 'fieldset',
      '#title' => 'Jammed messages',
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    );
    $form['configured']['table'] = array(
      '#type' => 'item',
      '#value' => theme('table', $headers, $data),
    );
  }
  return $form;
}