function update_test_system_info_alter

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

Implements hook_system_info_alter().

Checks the 'update_test.settings:system_info' configuration and sees if we need to alter the system info for the given $file 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 ($file->name) and the subarrays contain settings just for that module or theme.

File

core/modules/update/tests/modules/update_test/update_test.module, line 21

Code

function update_test_system_info_alter(&$info, Extension $file) {
    $setting = \Drupal::config('update_test.settings')->get('system_info');
    foreach ([
        '#all',
        $file->getName(),
    ] as $id) {
        if (!empty($setting[$id])) {
            foreach ($setting[$id] as $key => $value) {
                $info[$key] = $value;
            }
        }
    }
}

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