You are here

class TrustedHostSettings in Security Review 8

Provides the settings form for the TrustedHosts check.

Hierarchy

Expanded class hierarchy of TrustedHostSettings

1 file declares its use of TrustedHostSettings
TrustedHosts.php in src/Checks/TrustedHosts.php

File

src/CheckSettings/TrustedHostSettings.php, line 10

Namespace

Drupal\security_review\CheckSettings
View source
class TrustedHostSettings extends CheckSettings {

  /**
   * {@inheritdoc}
   */
  public function buildForm() {
    $form = [];
    $form['method'] = [
      '#type' => 'radios',
      '#title' => t('Check method'),
      '#description' => t('Detecting the $base_url in settings.php can be done via PHP tokenization (recommended) or including the file. Note that if you have custom functionality in your settings.php it will be executed if the file is included. Including the file can result in a more accurate $base_url check if you wrap the setting in conditional statements.'),
      '#options' => [
        'token' => t('Tokenize settings.php (recommended)'),
        'include' => t('Include settings.php'),
      ],
      '#default_value' => $this
        ->get('method', 'token'),
    ];
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, array $values) {
    $this
      ->set('method', $values['method']);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CheckSettings::$check protected property The parent check.
CheckSettings::$config protected property The configuration storage of the parent Check.
CheckSettings::get public function Gets a check-specific setting value identified by $key. Overrides CheckSettingsInterface::get
CheckSettings::set public function Sets a check-specific setting value identified by $key. Overrides CheckSettingsInterface::set
CheckSettings::validateForm public function Form validation handler. Overrides CheckSettingsInterface::validateForm
CheckSettings::__construct public function Creates a CheckSettings instance.
TrustedHostSettings::buildForm public function Form constructor. Overrides CheckSettings::buildForm
TrustedHostSettings::submitForm public function Form submission handler. Overrides CheckSettings::submitForm