diff --git a/core/includes/common.inc b/core/includes/common.inc index 86fc44a..18f4087 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -4911,21 +4911,6 @@ function _drupal_bootstrap_full($skip = FALSE) { // Initialize language (which can strip path prefix) prior to initializing // current_path(). drupal_language_initialize(); - - // Let all modules take action before the menu system handles the request. - // We do not want this while running update.php. - if (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update') { - // Prior to invoking hook_init(), initialize the theme (potentially a custom - // one for this page), so that: - // - Modules with hook_init() implementations that call theme() or - // theme_get_registry() don't initialize the incorrect theme. - // - The theme can have hook_*_alter() implementations affect page building - // (e.g., hook_form_alter(), hook_node_view_alter(), hook_page_alter()), - // ahead of when rendering starts. - menu_set_custom_theme(); - drupal_theme_initialize(); - module_invoke_all('init'); - } } /** diff --git a/core/lib/Drupal/Core/EventSubscriber/LegacyRequestSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/LegacyRequestSubscriber.php index 242f935..889ca0a 100644 --- a/core/lib/Drupal/Core/EventSubscriber/LegacyRequestSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/LegacyRequestSubscriber.php @@ -13,35 +13,24 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * KernelEvents::REQUEST event subscriber to initialize theme and modules. + * KernelEvents::REQUEST event subscriber to inform Drupal that it is fully bootstrapped. * * @todo Remove this subscriber when all of the code in it has been refactored. */ class LegacyRequestSubscriber implements EventSubscriberInterface { /** - * Initializes the rest of the legacy Drupal subsystems. + * Informs Drupal that it is fully bootstrapped. * * @param Symfony\Component\HttpKernel\Event\GetResponseEvent $event * The Event to process. */ public function onKernelRequestLegacy(GetResponseEvent $event) { if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) { - // Prior to invoking hook_init(), initialize the theme (potentially a - // custom one for this page), so that: - // - Modules with hook_init() implementations that call theme() or - // theme_get_registry() don't initialize the incorrect theme. - // - The theme can have hook_*_alter() implementations affect page - // building (e.g., hook_form_alter(), hook_node_view_alter(), - // hook_page_alter()), ahead of when rendering starts. - menu_set_custom_theme(); - drupal_theme_initialize(); - module_invoke_all('init'); - // Tell Drupal it is now fully bootstrapped (for the benefit of code that // calls drupal_get_bootstrap_phase()), but without having // _drupal_bootstrap_full() do anything, since we've already done the - // equivalent above and in earlier listeners. + // equivalent in earlier listeners. _drupal_bootstrap_full(TRUE); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); } diff --git a/core/lib/Drupal/Core/HtmlPageController.php b/core/lib/Drupal/Core/HtmlPageController.php index ab9af59..793fa4b 100644 --- a/core/lib/Drupal/Core/HtmlPageController.php +++ b/core/lib/Drupal/Core/HtmlPageController.php @@ -46,6 +46,16 @@ public function setContainer(ContainerInterface $container = NULL) { * A response object. */ public function content(Request $request, $_content) { + // Prior to invoking hook_init(), initialize the theme (potentially a + // custom one for this page), so that: + // - Modules with hook_init() implementations that call theme() or + // theme_get_registry() don't initialize the incorrect theme. + // - The theme can have hook_*_alter() implementations affect page + // building (e.g., hook_form_alter(), hook_node_view_alter(), + // hook_page_alter()), ahead of when rendering starts. + menu_set_custom_theme(); + drupal_theme_initialize(); + module_invoke_all('init'); // @todo When we have a Generator, we can replace the forward() call with // a render() call, which would handle ESI and hInclude as well. That will