Same name and namespace in other branches
  1. 10 core/modules/update/tests/modules/update_test/update_test.module \update_test_update_status_alter()
  2. 8.9.x core/modules/update/tests/modules/update_test/update_test.module \update_test_update_status_alter()
  3. 9 core/modules/update/tests/modules/update_test/update_test.module \update_test_update_status_alter()

Implements hook_update_status_alter().

Checks the 'update_test_update_status' variable and sees if we need to alter the update status for the given project based on the setting. The setting is expected to be a nested associative array. If the key '#all' is defined, its subarray will include .info keys and values for all modules and themes on the system. Otherwise, the settings array is keyed by the module or theme short name and the subarrays contain settings just for that module or theme.

File

modules/update/tests/update_test.module, line 72
Module for testing Update Manager functionality.

Code

function update_test_update_status_alter(&$projects) {
  $setting = variable_get('update_test_update_status', array());
  if (!empty($setting)) {
    foreach ($projects as $project_name => &$project) {
      foreach (array(
        '#all',
        $project_name,
      ) as $id) {
        if (!empty($setting[$id])) {
          foreach ($setting[$id] as $key => $value) {
            $project[$key] = $value;
          }
        }
      }
    }
  }
}