public static function ErrorLogConfigForm::buildForm in Error Log 8
Builds Error Log config form.
1 call to ErrorLogConfigForm::buildForm()
- error_log_form_system_logging_settings_alter in ./
error_log.module - Implements hook_form_system_logging_settings_alter().
File
- src/
Form/ ErrorLogConfigForm.php, line 16
Class
- ErrorLogConfigForm
- Implements an Error Log config form.
Namespace
Drupal\error_log\FormCode
public static function buildForm(array &$form) {
$config = \Drupal::config('error_log.settings');
$form['error_log'] = [
'#type' => 'details',
'#title' => t('Error Log'),
'#tree' => TRUE,
'#open' => TRUE,
'#description' => error_log_help('help.page.error_log'),
];
$options = [];
foreach (RfcLogLevel::getLevels() as $key => $value) {
$options["level_{$key}"] = $value;
}
$default_value = [];
foreach ($config
->get('log_levels') as $key => $value) {
$default_value[$key] = $value ? $key : 0;
}
$form['error_log']['log_levels'] = [
'#type' => 'checkboxes',
'#title' => t('Log levels'),
'#description' => t('Check the log levels which should be sent to the PHP error log.'),
'#options' => $options,
'#default_value' => $default_value,
];
$form['error_log']['ignored_channels'] = [
'#type' => 'textarea',
'#title' => t('Ignored channels'),
'#description' => t('A list of log channels for which messages should not be sent to the PHP error log (one channel per line). Commonly-configured log channels include <em>access denied</em> for 403 errors and <em>page not found</em> for 404 errors.'),
'#default_value' => implode("\n", $config
->get('ignored_channels') ?: []),
];
$form['#submit'][] = 'Drupal\\error_log\\Form\\ErrorLogConfigForm::submitForm';
}