function hook_requirements_alter

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Extension/module.api.php \hook_requirements_alter()
  2. 11.x core/lib/Drupal/Core/Extension/module.api.php \hook_requirements_alter()

Alters requirements data.

Implementations are able to alter the title, value, description or the severity of certain requirements defined by hook_requirements() implementations or even remove such entries.

Parameters

array $requirements: The requirements data to be altered.

See also

hook_requirements()

Related topics

1 function implements hook_requirements_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

requirements1_test_requirements_alter in core/modules/system/tests/modules/requirements1_test/requirements1_test.module
Implements hook_requirements_alter().
1 invocation of hook_requirements_alter()
SystemManager::listRequirements in core/modules/system/src/SystemManager.php
Displays the site status report. Can also be used as a pure check.

File

core/lib/Drupal/Core/Extension/module.api.php, line 1073

Code

function hook_requirements_alter(array &$requirements) : void {
    // Change the title from 'PHP' to 'PHP version'.
    $requirements['php']['title'] = t('PHP version');
    // Decrease the 'update status' requirement severity from warning to info.
    $requirements['update status']['severity'] = REQUIREMENT_INFO;
    // Remove a requirements entry.
    unset($requirements['foo']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.