Merge "Add attributes parameter to ShowSearchHitTitle"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 2 Nov 2017 05:40:05 +0000 (05:40 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 2 Nov 2017 05:40:05 +0000 (05:40 +0000)
docs/hooks.txt
includes/widget/search/FullSearchResultWidget.php

index effc6d9..6c1597f 100644 (file)
@@ -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
index 0d0fa12..4c98399 100644 (file)
@@ -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
                );