You are here

automatic_updates_9_3_shim.module in Automatic Updates 8.2

Contains hook implementations for Automatic Updates 9.3 shim module.

File

automatic_updates_9_3_shim/automatic_updates_9_3_shim.module
View source
<?php

/**
 * @file
 * Contains hook implementations for Automatic Updates 9.3 shim module.
 */

/**
 * Implements hook_page_top().
 */
function automatic_updates_9_3_shim_page_top() {

  // @todo Rely on the route option after https://www.drupal.org/i/3236497 is
  //   committed.
  // @todo Remove 'system.batch_page.html' after
  //   https://www.drupal.org/i/3238311 is committed.
  $skip_routes = [
    'system.batch_page.html',
    'automatic_updates.confirmation_page',
    'automatic_updates.report_update',
    'automatic_updates.module_update',
  ];
  $route_name = \Drupal::routeMatch()
    ->getRouteName();
  if (!in_array($route_name, $skip_routes, TRUE) && function_exists('update_page_top')) {
    update_page_top();
  }
}

/**
 * Implements hook_module_implements_alter().
 *
 * @todo Remove after https://www.drupal.org/i/3236497 is committed.
 */
function automatic_updates_9_3_shim_module_implements_alter(&$implementations, $hook) {
  if ($hook === 'page_top') {

    // Remove hook_page_top() implementation from the Update module. This '
    // implementation displays error messages about security releases. We call
    // this implementation in our own automatic_updates_page_top() except on our
    // own routes to avoid stale messages about the security releases after an
    // update.
    unset($implementations['update']);
  }
}