Change record status: 
Project: 
Introduced in branch: 
9.5.x
Introduced in version: 
9.5.0
Description: 

A new hook, hook_requirements_alter() has been introduced. Third-party module are able to:

  • Alter the title, value, description or even the severity of requirements previously defined via hook_requirements() hook implementations.
  • Delete requirements entry/entries previously defined via hook_requirements() hook implementations.

Of course they are able also to define new requirements but this is not recommended. In order to define new requirements entries, third-party should implement hook_requirements().

function mymodule_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 informational.
  $requirements['update status']['severity'] = REQUIREMENT_INFO;

  // Remove a requirements entry.
  unset($requirements['foo']);
}
Impacts: 
Module developers
Site templates, recipes and distribution developers

Comments

gambry’s picture

Comment // Decrease the 'update status' requirement severity from warning to warning. is probable meant to be // Decrease the 'update status' requirement severity from warning to informational.

gambry’s picture

changed.