You are here

function _automatic_updates_psa_requirements in Automatic Updates 7

Same name and namespace in other branches
  1. 8 automatic_updates.install \_automatic_updates_psa_requirements()

Display requirements from Public service announcements.

Parameters

array $requirements: The requirements array.

1 call to _automatic_updates_psa_requirements()
automatic_updates_requirements in ./automatic_updates.install
Implements hook_requirements().

File

./automatic_updates.install, line 95
Install, update and uninstall functions for the automatic_updates module.

Code

function _automatic_updates_psa_requirements(array &$requirements) {
  if (!variable_get('automatic_updates_enable_psa', TRUE)) {
    return;
  }
  $requirements['automatic_updates_psa'] = [
    'title' => t('<a href="@link">Public service announcements</a>', [
      '@link' => 'https://www.drupal.org/docs/7/update/automatic-updates#psas',
    ]),
    'severity' => REQUIREMENT_OK,
    'value' => t('No announcements requiring attention.'),
  ];
  $messages = AutomaticUpdatesPsa::getPublicServiceMessages();
  if (!empty($messages)) {
    $requirements['automatic_updates_psa']['severity'] = REQUIREMENT_ERROR;
    $requirements['automatic_updates_psa']['value'] = format_plural(count($messages), '@count urgent announcement requires your attention:', '@count urgent announcements require your attention:');
    $requirements['automatic_updates_psa']['description'] = theme('item_list', array(
      'items' => $messages,
    ));
  }
}