public function SettingsForm::buildForm in Logs HTTP 8
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/ SettingsForm.php, line 44
Class
- SettingsForm
- Defines a form that configures Logs http settings.
Namespace
Drupal\logs_http\FormCode
public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL) {
$config = $this
->config('logs_http.settings');
$form['enabled'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable'),
'#description' => $this
->t('Enable Logs HTTP'),
'#default_value' => $config
->get('enabled'),
];
$form['url'] = [
'#type' => 'url',
'#title' => $this
->t('Endpoint'),
'#description' => $this
->t('The URL to POST the data to.'),
'#default_value' => $config
->get('url'),
];
$form['severity_level'] = [
'#type' => 'select',
'#title' => $this
->t('Watchdog Severity'),
'#options' => RfcLogLevel::getLevels(),
'#default_value' => $config
->get('severity_level'),
'#description' => $this
->t('The minimum severity level to be reached before an event is sent to Logs.'),
];
$form['environment_uuid'] = [
'#type' => 'textfield',
'#title' => $this
->t('Unique ID'),
'#description' => $this
->t('An arbitrary ID that will identify the environment.'),
'#default_value' => $config
->get('environment_uuid'),
];
return parent::buildForm($form, $form_state);
}