public function LogStdoutConfigForm::buildForm in log_stdout 8.2
Same name and namespace in other branches
- 8 src/Form/LogStdoutConfigForm.php \Drupal\log_stdout\Form\LogStdoutConfigForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ LogStdoutConfigForm.php, line 19
Class
Namespace
Drupal\log_stdout\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// Form constructor.
$form = parent::buildForm($form, $form_state);
// Default settings.
$config = $this
->config('log_stdout.settings');
$form['use_stderr'] = [
'#title' => t('Write warning and error messages to stderr'),
'#type' => 'radios',
'#default_value' => $config
->get('use_stderr'),
'#options' => [
'0' => t('No'),
'1' => t('Yes'),
],
];
$form['format'] = [
'#type' => 'textarea',
'#title' => $this
->t('Log format'),
'#default_value' => $config
->get('format'),
'#description' => t('Specify the format of the log entry. Available variables are: <dl>' . '<dt><code>@base_url</code></dt><dd>Base URL of the site.</dd>' . '<dt><code>@timestamp</code></dt><dd>Unix timestamp of the log entry.</dd>' . '<dt><code>@type</code></dt><dd>The category to which this message belongs.</dd>' . '<dt><code>@ip</code></dt><dd>IP address of the user triggering the message.</dd>' . '<dt><code>@request_uri</code></dt><dd>The requested URI.</dd>' . '<dt><code>@referer</code></dt><dd>HTTP Referer if available.</dd>' . '<dt><code>@severity</code></dt><dd>The severity level of the event; ranges from 0 (Emergency) to 7 (Debug).</dd>' . '<dt><code>@uid</code></dt><dd>User ID.</dd>' . '<dt><code>@link</code></dt><dd>A link to associate with the message.</dd>' . '<dt><code>@message</code></dt><dd>The message to store in the log.</dd></dl>'),
];
return $form;
}