W3cubDocs

/Drupal 8

function hook_update_status_alter

hook_update_status_alter(&$projects)

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

Hooks
Define functions that alter the behavior of Drupal core.

File

core/modules/update/update.api.php, line 85
Hooks provided by the Update Manager module.

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'] = UPDATE_NOT_CHECKED;
      $projects[$project]['reason'] = t('Ignored from settings');
      if (!empty($settings[$project]['notes'])) {
        $projects[$project]['extra'][] = array(
          'class' => array('admin-note'),
          'label' => t('Administrator note'),
          'data' => $settings[$project]['notes'],
        );
      }
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!update!update.api.php/function/hook_update_status_alter/8.1.x