function hook_update_requirements_alter

Alters update requirements data.

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

Parameters

array $requirements: The requirements data to be altered.

See also

hook_update_requirements()

Related topics

2 functions implement hook_update_requirements_alter()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

ModuleUpdateRequirementsHooks::updateRequirementsAlter in core/modules/system/tests/modules/module_update_requirements/src/Hook/ModuleUpdateRequirementsHooks.php
Implements hook_update_requirements_alter().
UpdateScriptTestRequirements::updateAlter in core/modules/system/tests/modules/update_script_test/src/Hook/UpdateScriptTestRequirements.php
Implements hook_update_requirements_alter().
1 invocation of hook_update_requirements_alter()
update_check_requirements in core/includes/update.inc
Checks update requirements and reports errors and (optionally) warnings.

File

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

Code

function hook_update_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'] = RequirementSeverity::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.