public function LegacyRequestSubscriber::onKernelRequestLegacy

Initializes the rest of the legacy Drupal subsystems.

Parameters

Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The Event to process.

File

drupal/core/lib/Drupal/Core/EventSubscriber/LegacyRequestSubscriber.php, line 28
Definition of Drupal\Core\EventSubscriber\LegacyRequestSubscriber.

Class

LegacyRequestSubscriber
KernelEvents::REQUEST event subscriber to initialize theme and modules.

Namespace

Drupal\Core\EventSubscriber

Code

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.
    _drupal_bootstrap_full(TRUE);
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  }
}