DrupalKernelInterface.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. namespace Drupal\Core;
  3. use Symfony\Component\DependencyInjection\ContainerAwareInterface;
  4. use Symfony\Component\HttpKernel\HttpKernelInterface;
  5. use Symfony\Component\HttpFoundation\Request;
  6. /**
  7. * The interface for DrupalKernel, the core of Drupal.
  8. *
  9. * This interface extends Symfony's KernelInterface and adds methods for
  10. * responding to modules being enabled or disabled during its lifetime.
  11. */
  12. interface DrupalKernelInterface extends HttpKernelInterface, ContainerAwareInterface {
  13. /**
  14. * Event fired when the service container finished initializing in subrequest.
  15. *
  16. * This event allows you to initialize overrides such as language to the
  17. * services.
  18. *
  19. * @var string
  20. */
  21. const CONTAINER_INITIALIZE_SUBREQUEST_FINISHED = 'kernel.container.finish_container_initialize_subrequest';
  22. /**
  23. * Boots the current kernel.
  24. *
  25. * @return $this
  26. */
  27. public function boot();
  28. /**
  29. * Shuts down the kernel.
  30. */
  31. public function shutdown();
  32. /**
  33. * Discovers available serviceProviders.
  34. *
  35. * @return array
  36. * The available serviceProviders.
  37. */
  38. public function discoverServiceProviders();
  39. /**
  40. * Returns all registered service providers.
  41. *
  42. * @param string $origin
  43. * The origin for which to return service providers; one of 'app' or 'site'.
  44. *
  45. * @return array
  46. * An associative array of ServiceProvider objects, keyed by name.
  47. */
  48. public function getServiceProviders($origin);
  49. /**
  50. * Gets the current container.
  51. *
  52. * @return \Symfony\Component\DependencyInjection\ContainerInterface
  53. * A ContainerInterface instance.
  54. */
  55. public function getContainer();
  56. /**
  57. * Returns the cached container definition - if any.
  58. *
  59. * This also allows inspecting a built container for debugging purposes.
  60. *
  61. * @return array|null
  62. * The cached container definition or NULL if not found in cache.
  63. */
  64. public function getCachedContainerDefinition();
  65. /**
  66. * Set the current site path.
  67. *
  68. * @param string $path
  69. * The current site path.
  70. *
  71. * @throws \LogicException
  72. * In case the kernel is already booted.
  73. */
  74. public function setSitePath($path);
  75. /**
  76. * Get the site path.
  77. *
  78. * @return string
  79. * The current site path.
  80. */
  81. public function getSitePath();
  82. /**
  83. * Gets the app root.
  84. *
  85. * @return string
  86. */
  87. public function getAppRoot();
  88. /**
  89. * Updates the kernel's list of modules to the new list.
  90. *
  91. * The kernel needs to update its bundle list and container to match the new
  92. * list.
  93. *
  94. * @param array $module_list
  95. * The new list of modules.
  96. * @param array $module_filenames
  97. * List of module filenames, keyed by module name.
  98. */
  99. public function updateModules(array $module_list, array $module_filenames = []);
  100. /**
  101. * Force a container rebuild.
  102. *
  103. * @return \Symfony\Component\DependencyInjection\ContainerInterface
  104. */
  105. public function rebuildContainer();
  106. /**
  107. * Invalidate the service container for the next request.
  108. */
  109. public function invalidateContainer();
  110. /**
  111. * Prepare the kernel for handling a request without handling the request.
  112. *
  113. * @param \Symfony\Component\HttpFoundation\Request $request
  114. * The current request.
  115. *
  116. * @return $this
  117. *
  118. * @deprecated in Drupal 8.0.x and will be removed before 9.0.0. Only used by
  119. * legacy front-controller scripts.
  120. */
  121. public function prepareLegacyRequest(Request $request);
  122. /**
  123. * Helper method that does request related initialization.
  124. *
  125. * @param \Symfony\Component\HttpFoundation\Request $request
  126. * The current request.
  127. */
  128. public function preHandle(Request $request);
  129. /**
  130. * Helper method that loads legacy Drupal include files.
  131. */
  132. public function loadLegacyIncludes();
  133. }