From: jenkins-bot Date: Thu, 2 Nov 2017 05:40:05 +0000 (+0000) Subject: Merge "Add attributes parameter to ShowSearchHitTitle" X-Git-Tag: 1.31.0-rc.0~1619 X-Git-Url: http://git.cyclocoop.org/%22%20%20.%20generer_url_ecrire%28%22mots_tous%22%29%20.%20%22?a=commitdiff_plain;h=5120937028f768749d058aa91dde82a96de0af1c;hp=f783b2707183c64fcd2dc7e43e6c3c38c0c4f02b;p=lhc%2Fweb%2Fwiklou.git Merge "Add attributes parameter to ShowSearchHitTitle" --- diff --git a/docs/hooks.txt b/docs/hooks.txt index effc6d9ee2..6c1597f3de 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2942,6 +2942,7 @@ $result: The SearchResult object $terms: String of the search terms entered $specialSearch: The SpecialSearch object &$query: Array of query string parameters for the link representing the search result. +&$attributes: Array of title link attributes, can be modified by extension. 'SidebarBeforeOutput': Allows to edit sidebar just before it is output by skins. Warning: This hook is run on each display. You should consider to use diff --git a/includes/widget/search/FullSearchResultWidget.php b/includes/widget/search/FullSearchResultWidget.php index 0d0fa12411..4c9839966b 100644 --- a/includes/widget/search/FullSearchResultWidget.php +++ b/includes/widget/search/FullSearchResultWidget.php @@ -133,13 +133,14 @@ class FullSearchResultWidget implements SearchResultWidget { $title = clone $result->getTitle(); $query = []; + $attributes = [ 'data-serp-pos' => $position ]; Hooks::run( 'ShowSearchHitTitle', - [ &$title, &$snippet, $result, $terms, $this->specialPage, &$query ] ); + [ &$title, &$snippet, $result, $terms, $this->specialPage, &$query, &$attributes ] ); $link = $this->linkRenderer->makeLink( $title, $snippet, - [ 'data-serp-pos' => $position ], + $attributes, $query );