Skip to content
Snippets Groups Projects
Commit 39986999 authored by Adam G-H's avatar Adam G-H Committed by Ted Bowman
Browse files

Issue #3272060 by phenaproxima: Use route option to determine if readiness...

Issue #3272060 by phenaproxima: Use route option to determine if readiness checks should be shown on a route
parent 2487d9c2
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@ automatic_updates.report_update:
options:
_admin_route: TRUE
_maintenance_access: TRUE
_automatic_updates_readiness_messages: skip
automatic_updates.module_update:
path: '/admin/modules/automatic-update'
defaults:
......@@ -47,6 +48,7 @@ automatic_updates.module_update:
options:
_admin_route: TRUE
_maintenance_access: TRUE
_automatic_updates_readiness_messages: skip
automatic_updates.theme_update:
path: '/admin/theme/automatic-update'
defaults:
......@@ -57,3 +59,4 @@ automatic_updates.theme_update:
options:
_admin_route: TRUE
_maintenance_access: TRUE
_automatic_updates_readiness_messages: skip
services:
automatic_updates.route_subscriber:
class: Drupal\automatic_updates\Routing\RouteSubscriber
tags:
- { name: event_subscriber }
automatic_updates.readiness_validation_manager:
class: Drupal\automatic_updates\Validation\ReadinessValidationManager
arguments:
......
<?php
namespace Drupal\automatic_updates\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
/**
* Modifies route definitions.
*
* @internal
*/
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
$disabled_routes = [
'update.theme_update',
'system.theme_install',
'update.module_update',
'update.module_install',
'update.status',
'update.report_update',
'update.report_install',
'update.settings',
'system.status',
'update.confirmation_page',
];
foreach ($disabled_routes as $route) {
$route = $collection->get($route);
if ($route) {
$route->setOption('_automatic_updates_readiness_messages', 'skip');
}
}
}
}
......@@ -147,23 +147,8 @@ final class AdminReadinessMessages implements ContainerInjectionInterface {
}
if ($this->adminContext->isAdminRoute() && $this->currentUser->hasPermission('administer site configuration')) {
// These routes don't need additional nagging.
$disabled_routes = [
'update.theme_update',
'system.theme_install',
'update.module_update',
'update.module_install',
'update.status',
'update.report_update',
'update.report_install',
'update.settings',
'system.status',
'update.confirmation_page',
'automatic_updates.report_update',
'automatic_updates.module_update',
'automatic_updates.theme_update',
];
return !in_array($this->currentRouteMatch->getRouteName(), $disabled_routes, TRUE);
$route = $this->currentRouteMatch->getRouteObject();
return $route && $route->getOption('_automatic_updates_readiness_messages') !== 'skip';
}
return FALSE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment