class CheckSettings in Security Review 8
Defines the default implementation of CheckSettingsInterface.
Hierarchy
- class \Drupal\security_review\CheckSettings implements CheckSettingsInterface
Expanded class hierarchy of CheckSettings
1 file declares its use of CheckSettings
- TrustedHostSettings.php in src/
CheckSettings/ TrustedHostSettings.php
File
- src/
CheckSettings.php, line 10
Namespace
Drupal\security_reviewView source
class CheckSettings implements CheckSettingsInterface {
/**
* The parent check.
*
* @var \Drupal\security_review\Check
*/
protected $check;
/**
* The configuration storage of the parent Check.
*
* @var \Drupal\Core\Config\Config $config
*/
protected $config;
/**
* Creates a CheckSettings instance.
*
* @param \Drupal\security_review\Check $check
* The parent Check.
* @param \Drupal\Core\Config\Config $config
* The parent Check's configuration.
*/
public function __construct(Check $check, Config &$config) {
$this->check = $check;
$this->config = $config;
}
/**
* {@inheritdoc}
*/
public function get($key, $default_value = NULL) {
$value = $this->config
->get('settings.' . $key);
if ($value == NULL) {
return $default_value;
}
return $value;
}
/**
* {@inheritdoc}
*/
public function set($key, $value) {
$this->config
->set('settings.' . $key, $value);
$this->config
->save();
return $this;
}
/**
* {@inheritdoc}
*/
public function buildForm() {
return [];
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, array $values) {
// Validation is optional.
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, array $values) {
// Handle submission.
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CheckSettings:: |
protected | property | The parent check. | |
CheckSettings:: |
protected | property | The configuration storage of the parent Check. | |
CheckSettings:: |
public | function |
Form constructor. Overrides CheckSettingsInterface:: |
1 |
CheckSettings:: |
public | function |
Gets a check-specific setting value identified by $key. Overrides CheckSettingsInterface:: |
|
CheckSettings:: |
public | function |
Sets a check-specific setting value identified by $key. Overrides CheckSettingsInterface:: |
|
CheckSettings:: |
public | function |
Form submission handler. Overrides CheckSettingsInterface:: |
1 |
CheckSettings:: |
public | function |
Form validation handler. Overrides CheckSettingsInterface:: |
|
CheckSettings:: |
public | function | Creates a CheckSettings instance. |