1 dblog.module dblog_form_system_logging_settings_alter(&$form, $form_state)

Implements hook_form_FORM_ID_alter() for system_logging_settings().

File

core/modules/dblog/dblog.module, line 153
System monitoring and logging for administrators.

Code

function dblog_form_system_logging_settings_alter(&$form, $form_state) {
  $form['dblog_row_limit'] = array(
    '#type' => 'select',
    '#title' => t('Database log messages to keep'),
    '#default_value' => config_get('system.core', 'log_row_limit'),
    '#options' => array(0 => t('All')) + backdrop_map_assoc(array(100, 1000, 10000, 100000, 1000000)),
    '#description' => t('The maximum number of messages to keep in the database log. Requires a <a href="@cron">cron maintenance task</a>.', array('@cron' => url('admin/reports/status')))
  );

  $format = config_get('system.core', 'log_date_format');
  $pattern = isset($form_state['values']['dblog_date_format']) ? $form_state['values']['dblog_date_format'] : $format;
  $preview = !empty($pattern) ? t('Displayed as %date', array('%date' => format_date(REQUEST_TIME, 'custom', $pattern))) : '';

  $form['dblog_date_format'] = array(
    '#type' => 'textfield',
    '#title' => t('Date format for log messages'),
    '#maxlength' => 100,
    '#description' => t('A date format using PHP date and time codes. See the <a href="@url">PHP manual</a> for available options.', array('@url' => 'http://php.net/manual/function.date.php')),
    '#default_value' => $pattern,
    '#field_suffix' => '<small class="pattern-preview">' . $preview . '</small>',
    '#ajax' => array(
      'callback' => 'system_date_time_lookup',
      'event' => 'keyup',
      'progress' => array('type' => 'none', 'message' => NULL),
      'disable' => FALSE,
    ),
    '#required' => TRUE,
    '#wrapper_attributes' => array(
      'id' => 'date-format-pattern',
    ),
  );
  $form['#submit'][] = 'dblog_logging_settings_submit';
}