function hook_update_status_alter

Same name in other branches
  1. 7.x modules/update/update.api.php \hook_update_status_alter()
  2. 9 core/modules/update/update.api.php \hook_update_status_alter()
  3. 10 core/modules/update/update.api.php \hook_update_status_alter()
  4. 11.x core/modules/update/update.api.php \hook_update_status_alter()

Alter the information about available updates for projects.

Parameters

$projects: Reference to an array of information about available updates to each project installed on the system.

See also

update_calculate_project_data()

Related topics

1 function implements hook_update_status_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

update_test_update_status_alter in core/modules/update/tests/modules/update_test/update_test.module
Implements hook_update_status_alter().
1 invocation of hook_update_status_alter()
update_calculate_project_data in core/modules/update/update.compare.inc
Calculates the current update status of all projects on the site.

File

core/modules/update/update.api.php, line 87

Code

function hook_update_status_alter(&$projects) {
    $settings = \Drupal::config('update_advanced.settings')->get('projects');
    foreach ($projects as $project => $project_info) {
        if (isset($settings[$project]) && isset($settings[$project]['check']) && ($settings[$project]['check'] == 'never' || isset($project_info['recommended']) && $settings[$project]['check'] === $project_info['recommended'])) {
            $projects[$project]['status'] = UpdateFetcherInterface::NOT_CHECKED;
            $projects[$project]['reason'] = t('Ignored from settings');
            if (!empty($settings[$project]['notes'])) {
                $projects[$project]['extra'][] = [
                    'class' => [
                        'admin-note',
                    ],
                    'label' => t('Administrator note'),
                    'data' => $settings[$project]['notes'],
                ];
            }
        }
    }
}

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