From acaf93a810af64099efef54fc9e5271d46c96acd Mon Sep 17 00:00:00 2001
From: xjm <xjm@65776.no-reply.drupal.org>
Date: Mon, 4 Dec 2017 21:18:26 -0600
Subject: [PATCH] Revert "Issue #2662574 by RajeevK, Adita, pritish.kumar,
 afi13, AjitS, greyghost: Theme suggestions may not be in theme include files,
 Search and Views UI suggestions are not (always) found"

This reverts commit 81d17351e0961df47721879d4725199e21eaa9a6.
---
 core/lib/Drupal/Core/Render/theme.api.php | 8 --------
 core/modules/search/search.module         | 7 -------
 core/modules/search/search.pages.inc      | 7 +++++++
 core/modules/views_ui/views_ui.module     | 7 -------
 core/modules/views_ui/views_ui.theme.inc  | 7 +++++++
 5 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/core/lib/Drupal/Core/Render/theme.api.php b/core/lib/Drupal/Core/Render/theme.api.php
index 754641cce756..f91411b742ed 100644
--- a/core/lib/Drupal/Core/Render/theme.api.php
+++ b/core/lib/Drupal/Core/Render/theme.api.php
@@ -613,10 +613,6 @@ function hook_preprocess_HOOK(&$variables) {
  * hook called (in this case 'node__article') is available in
  * $variables['theme_hook_original'].
  *
- * Implementations of this hook must be placed in *.module or *.theme files, or
- * must otherwise make sure that the hook implementation is available at
- * any given time.
- *
  * @todo Add @code sample.
  *
  * @param array $variables
@@ -698,10 +694,6 @@ function hook_theme_suggestions_alter(array &$suggestions, array $variables, $ho
  * hook called (in this case 'node__article') is available in
  * $variables['theme_hook_original'].
  *
- * Implementations of this hook must be placed in *.module or *.theme files, or
- * must otherwise make sure that the hook implementation is available at
- * any given time.
- *
  * @todo Add @code sample.
  *
  * @param array $suggestions
diff --git a/core/modules/search/search.module b/core/modules/search/search.module
index 5be9206bc368..33171ae0cfe9 100644
--- a/core/modules/search/search.module
+++ b/core/modules/search/search.module
@@ -106,13 +106,6 @@ function search_theme() {
   ];
 }
 
-/**
- * Implements hook_theme_suggestions_HOOK().
- */
-function search_theme_suggestions_search_result(array $variables) {
-  return ['search_result__' . $variables['plugin_id']];
-}
-
 /**
  * Implements hook_preprocess_HOOK() for block templates.
  */
diff --git a/core/modules/search/search.pages.inc b/core/modules/search/search.pages.inc
index 703b2ff550ca..9467dd82501b 100644
--- a/core/modules/search/search.pages.inc
+++ b/core/modules/search/search.pages.inc
@@ -8,6 +8,13 @@
 use Drupal\Component\Utility\UrlHelper;
 use Drupal\Core\Language\LanguageInterface;
 
+/**
+ * Implements hook_theme_suggestions_HOOK().
+ */
+function search_theme_suggestions_search_result(array $variables) {
+  return ['search_result__' . $variables['plugin_id']];
+}
+
 /**
  * Prepares variables for individual search result templates.
  *
diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module
index bae74a83e76b..15f85e3a023b 100644
--- a/core/modules/views_ui/views_ui.module
+++ b/core/modules/views_ui/views_ui.module
@@ -156,13 +156,6 @@ function views_ui_preprocess_views_view(&$variables) {
   }
 }
 
-/**
- * Implements hook_theme_suggestions_HOOK().
- */
-function views_ui_theme_suggestions_views_ui_view_preview_section(array $variables) {
-  return ['views_ui_view_preview_section__' . $variables['section']];
-}
-
 /**
  * Returns contextual links for each handler of a certain section.
  *
diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc
index d1aef4c46c4a..e6ef8756ff7d 100644
--- a/core/modules/views_ui/views_ui.theme.inc
+++ b/core/modules/views_ui/views_ui.theme.inc
@@ -547,3 +547,10 @@ function template_preprocess_views_ui_view_preview_section(&$variables) {
     $variables['links'] = $build;
   }
 }
+
+/**
+ * Implements hook_theme_suggestions_HOOK().
+ */
+function views_ui_theme_suggestions_views_ui_view_preview_section(array $variables) {
+  return ['views_ui_view_preview_section__' . $variables['section']];
+}
-- 
GitLab