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 154
System monitoring and logging for administrators.

Code

function dblog_form_system_logging_settings_alter(&$form, $form_state) {
  $site_config = config('system.core');
  $form['dblog'] = array(
    '#type' => 'fieldset',
    '#title' => t('Database log'),
  );
  $form['dblog']['dblog_row_limit'] = array(
    '#type' => 'select',
    '#title' => t('Messages to keep'),
    '#default_value' => $site_config->get('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/config/system/cron'))),
  );

  $format = $site_config->get('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']['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['dblog']['dblog_max_length'] = array(
    '#type' => 'number',
    '#title' => t('Abbreviated message length'),
    '#default_value' => $site_config->get('log_max_length'),
    '#description' => t('The maximum log message length when abbreviated on the <a href="@url">recent log messages page</a>.', array('@url' => url('admin/reports/dblog'))),
    '#required' => TRUE,
    '#min' => 1,
    '#max' => 255,
    '#field_suffix' => t('characters'),
  );

  $form['#submit'][] = 'dblog_logging_settings_submit';
}