Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Most entries returned by hook_requirements() no longer return an enforced severity for positive assertions.

  1. All neutral/informational requirements check results should not return a hard-coded severity level.
  2. Only return REQUIREMENT_INFO or REQUIREMENT_OK if you want to enforce the corresponding visual presentation.

This is because:

  • The Drupal installer defaults to REQUIREMENT_OK for positive assertions, so the user who is installing Drupal gets the appropriate visual feedback for met requirements.
  • The Status report page defaults to REQUIREMENT_INFO for all requirements checks. The visual feedback for positive assertions would turn the entire page "green" otherwise.

Drupal 7

function mymodule_requirements() {
  $exists = (...);
  $requirements['foo'] = array(
    'title' => 'Foo extension',
    'value' => $exists ? $t('Enabled') : $t('Missing'),
    'severity' => !$exists ? REQUIREMENT_ERROR : REQUIREMENT_OK,
  );
  return $requirements;
}

Drupal 8

function mymodule_requirements() {
  $exists = (...);
  $requirements['foo'] = array(
    'title' => 'Foo extension',
    'value' => $exists ? $t('Enabled') : $('Missing'),
    // Note: Depending on your code logic, you can also omit the 'severity' key entirely.
    'severity' => !$exists ? REQUIREMENT_ERROR : NULL,
  );
  return $requirements;
}
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done