diff --git a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php index be94ee3..2008c28 100644 --- a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php @@ -204,6 +204,7 @@ protected function prepare(array $main_content, Request $request, RouteMatchInte // $page is now fully built. Find all non-empty page regions, and add a // theme wrapper function that allows them to be consistently themed. + \Drupal::moduleHandler()->load('system'); $regions = system_region_list(\Drupal::theme()->getActiveTheme()->getName()); foreach (array_keys($regions) as $region) { if (!empty($page[$region])) { diff --git a/core/modules/block/src/BlockRepository.php b/core/modules/block/src/BlockRepository.php index c11a4fe..d78e724 100644 --- a/core/modules/block/src/BlockRepository.php +++ b/core/modules/block/src/BlockRepository.php @@ -53,6 +53,7 @@ public function __construct(EntityManagerInterface $entity_manager, ThemeManager * An array of human-readable region names keyed by machine name. */ protected function getRegionNames() { + \Drupal::moduleHandler()->load('system'); return system_region_list($this->getTheme()); } diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php index 525177f..ac387d2 100644 --- a/core/modules/views/src/Views.php +++ b/core/modules/views/src/Views.php @@ -522,6 +522,20 @@ public static function getPluginTypes($type = NULL) { } /** + * #pre_render callback to set contextual links for views using a Page display. + */ + public static function pageDisplayPreRender(array $element) { + // If the main content of this page contains a view, attach its contextual + // links to the overall page array. This allows them to be rendered directly + // next to the page title. + \Drupal::moduleHandler()->load('views'); + if ($view = views_get_page_view()) { + views_add_contextual_links($element, 'page', $view, $view->current_display); + } + return $element; + } + + /** * Translates a string to the current language or to a given language. * * See the t() documentation for details. diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 507758c..6cbe62c 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -283,24 +283,11 @@ function views_theme_suggestions_comment_alter(array &$suggestions, array $varia /** * Implements hook_element_info_alter(). * - * @see views_page_display_pre_render() + * @see \Drupal\views\Views::pageDisplayPreRender * @see views_preprocess_page() */ function views_element_info_alter(&$types) { - $types['page']['#pre_render'][] = 'views_page_display_pre_render'; -} - -/** - * #pre_render callback to set contextual links for views using a Page display. - */ -function views_page_display_pre_render(array $element) { - // If the main content of this page contains a view, attach its contextual - // links to the overall page array. This allows them to be rendered directly - // next to the page title. - if ($view = views_get_page_view()) { - views_add_contextual_links($element, 'page', $view, $view->current_display); - } - return $element; + $types['page']['#pre_render'][] = '\Drupal\views\Views::pageDisplayPreRender'; } /** @@ -314,7 +301,7 @@ function views_preprocess_html(&$variables) { // If the page contains a view as its main content, contextual links may have // been attached to the page as a whole; for example, by - // views_page_display_pre_render(). + // \Drupal\views\Views::pageDisplayPreRender(). // This allows them to be associated with the page and rendered by default // next to the page title (which we want). However, it also causes the // Contextual Links module to treat the wrapper for the entire page (i.e.,