function template_preprocess_search_result
Same name and namespace in other branches
- 10 core/modules/search/search.pages.inc \template_preprocess_search_result()
- 9 core/modules/search/search.pages.inc \template_preprocess_search_result()
- 8.9.x core/modules/search/search.pages.inc \template_preprocess_search_result()
- 7.x modules/search/search.pages.inc \template_preprocess_search_result()
Prepares variables for individual search result templates.
Default template: search-result.html.twig
Parameters
array $variables: An array with the following elements:
- result: Individual search result.
- plugin_id: Plugin the search results came from.
- title_prefix: Additional output populated by modules, intended to be displayed in front of the main title tag that appears in the template.
- title_suffix: Additional output populated by modules, intended to be displayed after the main title tag that appears in the template.
- title_attributes: HTML attributes for the title.
- content_attributes: HTML attributes for the content.
Deprecated
in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme().
See also
https://www.drupal.org/node/3504125
File
-
core/
modules/ search/ search.module, line 355
Code
function template_preprocess_search_result(&$variables) : void {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
\Drupal::service(SearchThemeHooks::class)->preprocessSearchResult($variables);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.