You are here

function _jammer_messages_settings in Jammer 7

Same name and namespace in other branches
  1. 6 jammer_messages.module \_jammer_messages_settings()

Central configuration form for jammer_messages.

Return value

array

1 string reference to '_jammer_messages_settings'
jammer_messages_menu in ./jammer_messages.module
Implements hook_menu().

File

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

Code

function _jammer_messages_settings() {
  $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(t('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();
  foreach ($current_settings as $setting) {
    $data[] = array(
      $setting->mid,
      $setting->message_string,
      l(t('Delete'), 'admin/config/user-interface/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',
      '#markup' => theme('table', array(
        'header' => $headers,
        'rows' => $data,
      )),
    );
  }
  return $form;
}