diff --git a/core/modules/search/search.module b/core/modules/search/search.module index 462e4db..afe514d 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -11,6 +11,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\Core\Template\Attribute; /** * Matches all 'N' Unicode character classes (numbers) @@ -103,7 +104,12 @@ function search_help($route_name, RouteMatchInterface $route_match) { function search_theme() { return array( 'search_result' => array( - 'variables' => array('result' => NULL, 'plugin_id' => NULL), + 'variables' => [ + 'result' => NULL, + 'plugin_id' => NULL, + 'title_attributes' => new Attribute(), + 'content_attributes' => new Attribute(), + ], 'file' => 'search.pages.inc', ), ); diff --git a/core/modules/search/search.pages.inc b/core/modules/search/search.pages.inc index dba393a..b50a6cd 100644 --- a/core/modules/search/search.pages.inc +++ b/core/modules/search/search.pages.inc @@ -7,7 +7,6 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Language\LanguageInterface; -use Drupal\Core\Template\Attribute; /** * Implements hook_theme_suggestions_HOOK(). @@ -65,7 +64,5 @@ function template_preprocess_search_result(&$variables) { '#template' => '{{ info|safe_join(" - ") }}', '#context' => array('info' => $info), ); - $variables['title_attributes'] = isset($variables['title_attributes']) ? new Attribute($variables['title_attributes']) : new Attribute(); - $variables['content_attributes'] = isset($variables['content_attributes']) ? new Attribute($variables['content_attributes']) : new Attribute(); }