LdapDebugSettings.php in Lightweight Directory Access Protocol (LDAP) 8.3
File
ldap_help/src/Form/LdapDebugSettings.php
View source
<?php
namespace Drupal\ldap_help\Form;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
class LdapDebugSettings extends ConfigFormBase {
public function getFormId() {
return 'ldap_help_debug_settings';
}
protected function getEditableConfigNames() {
return [
'ldap_help.settings',
];
}
public function buildForm(array $form, FormStateInterface $form_state) {
$form['#title'] = "Configure LDAP Preferences";
$form['watchdog_detail'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enabled Detailed LDAP Watchdog logging.'),
'#description' => $this
->t('This is generally useful for debugging and reporting issues with the LDAP modules and should not be left enabled in a production environment.'),
'#default_value' => $this
->config('ldap_help.settings')
->get('watchdog_detail'),
];
$form = parent::buildForm($form, $form_state);
return $form;
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this
->config('ldap_help.settings')
->set('watchdog_detail', $form_state
->getValue('watchdog_detail'))
->save();
}
}