function UpdateTestHooks::updateStatusAlter

Implements hook_update_status_alter().

Checks the 'update_test.settings:update_status' configuration 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.yml 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

core/modules/update/tests/modules/update_test/src/Hook/UpdateTestHooks.php, line 49

Class

UpdateTestHooks
Hook implementations for update_test.

Namespace

Drupal\update_test\Hook

Code

public function updateStatusAlter(&$projects) {
    $setting = \Drupal::config('update_test.settings')->get('update_status');
    if (!empty($setting)) {
        foreach ($projects as $project_name => &$project) {
            foreach ([
                '#all',
                $project_name,
            ] as $id) {
                if (!empty($setting[$id])) {
                    foreach ($setting[$id] as $key => $value) {
                        $project[$key] = $value;
                    }
                }
            }
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.