From: Jack Phoenix Date: Wed, 11 Jul 2018 08:06:10 +0000 (+0300) Subject: Pass $opts by reference to subscribers of 'SpecialSearchPowerBox' hook to allow them... X-Git-Tag: 1.34.0-rc.0~4766 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=358b2d1d7770c8e36219a44bf4f943fe429a46aa;hp=0e2e1254dfefb89c3a81f4053e69fa01d478a22e;p=lhc%2Fweb%2Fwiklou.git Pass $opts by reference to subscribers of 'SpecialSearchPowerBox' hook to allow them to modify it wikiHow added a new hook called 'SpecialSearchPowerBoxOpts', which was passed only &$opts, so that the Finner extension can unset the $opts array. Enhancing the pre-existing hook is a better solution in this case. Change-Id: I091cbdc78fc779144554d8420a95435b7048c407 --- diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 18ddc2f759..5110e5190d 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -51,6 +51,8 @@ production. * Added new 'ArticleShowPatrolFooter' hook, which allows extensions to determine if the [mark as patrolled] link should be shown at the footer of patrollable pages. +* The array of hidden options ($opts) passed to the 'SpecialSearchPowerBox' hook + is now passed by reference, allowing extensions to modify or even unset it. === External library changes in 1.32 === * … diff --git a/docs/hooks.txt b/docs/hooks.txt index 5f39aa956e..c7874c33af 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -3344,7 +3344,7 @@ called. the advanced form, a.k.a. power search box. &$showSections: an array to add values with more options to $term: the search term (not a title object) -$opts: an array of hidden options (containing 'redirs' and 'profile') +&$opts: an array of hidden options (containing 'redirs' and 'profile') 'SpecialSearchProfileForm': Allows modification of search profile forms. $search: special page object diff --git a/includes/widget/search/SearchFormWidget.php b/includes/widget/search/SearchFormWidget.php index 2c885630aa..e40ae2909a 100644 --- a/includes/widget/search/SearchFormWidget.php +++ b/includes/widget/search/SearchFormWidget.php @@ -270,7 +270,7 @@ class SearchFormWidget { $showSections = [ 'namespaceTables' => "" . implode( '
', $namespaceTables ) . '
', ]; - Hooks::run( 'SpecialSearchPowerBox', [ &$showSections, $term, $opts ] ); + Hooks::run( 'SpecialSearchPowerBox', [ &$showSections, $term, &$opts ] ); $hidden = ''; foreach ( $opts as $key => $value ) {