class LoggingForm

Configure logging settings for this site.

Hierarchy

Expanded class hierarchy of LoggingForm

1 string reference to 'LoggingForm'
system.routing.yml in drupal/core/modules/system/system.routing.yml
drupal/core/modules/system/system.routing.yml

File

drupal/core/modules/system/lib/Drupal/system/Form/LoggingForm.php, line 15
Contains \Drupal\system\Form\LoggingForm.

Namespace

Drupal\system\Form
View source
class LoggingForm extends SystemConfigFormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormID() {
    return 'system_logging_settings';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, array &$form_state) {
    $config = $this->configFactory
      ->get('system.logging');
    $form['error_level'] = array(
      '#type' => 'radios',
      '#title' => t('Error messages to display'),
      '#default_value' => $config
        ->get('error_level'),
      '#options' => array(
        ERROR_REPORTING_HIDE => t('None'),
        ERROR_REPORTING_DISPLAY_SOME => t('Errors and warnings'),
        ERROR_REPORTING_DISPLAY_ALL => t('All messages'),
        ERROR_REPORTING_DISPLAY_VERBOSE => t('All messages, with backtrace information'),
      ),
      '#description' => t('It is recommended that sites running on production environments do not display any errors.'),
    );
    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, array &$form_state) {
    $this->configFactory
      ->get('system.logging')
      ->set('error_level', $form_state['values']['error_level'])
      ->save();
    parent::submitForm($form, $form_state);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LoggingForm::buildForm public function Implements \Drupal\Core\Form\FormInterface::buildForm(). Overrides SystemConfigFormBase::buildForm
LoggingForm::getFormID public function Returns a unique string identifying the form. Overrides FormInterface::getFormID
LoggingForm::submitForm public function Implements \Drupal\Core\Form\FormInterface::submitForm(). Overrides SystemConfigFormBase::submitForm
SystemConfigFormBase::$configFactory protected property Stores the configuration factory.
SystemConfigFormBase::create public static function Instantiates a new instance of this controller. Overrides ControllerInterface::create 9
SystemConfigFormBase::validateForm public function Implements \Drupal\Core\Form\FormInterface::validateForm(). Overrides FormInterface::validateForm 7
SystemConfigFormBase::__construct public function Constructs a \Drupal\system\SystemConfigFormBase object. 9