function UpdateScriptTestRequirements::update
Implements hook_update_requirements().
Attributes
#[Hook('update_requirements')]
File
-
core/
modules/ system/ tests/ modules/ update_script_test/ src/ Hook/ UpdateScriptTestRequirements.php, line 23
Class
- UpdateScriptTestRequirements
- Requirements for the Update Script Test module.
Namespace
Drupal\update_script_test\HookCode
public function update() : array {
$requirements = [];
// Set a requirements warning or error when the test requests it.
$requirement_type = $this->configFactory
->get('update_script_test.settings')
->get('requirement_type');
switch ($requirement_type) {
case RequirementSeverity::Warning->value:
$requirements['update_script_test'] = [
'title' => 'Update script test',
'value' => 'Warning',
'description' => 'This is a requirements warning provided by the update_script_test module.',
'severity' => RequirementSeverity::Warning,
];
break;
case RequirementSeverity::Error->value:
$requirements['update_script_test'] = [
'title' => 'Update script test',
'value' => 'Error',
'description' => 'This is a (buggy description fixed in update_script_test_requirements_alter()) requirements error provided by the update_script_test module.',
'severity' => RequirementSeverity::Error,
];
break;
}
return $requirements;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.