From: MatmaRex Date: Mon, 20 May 2013 12:00:52 +0000 (+0200) Subject: Don't reinvent the wheel in SpecialRecentchangeslinked::getExtraOptions X-Git-Tag: 1.31.0-rc.0~19305^2~1 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=feb4ffcf7215bfdc87677b2ac89d91a5306cc1fe;p=lhc%2Fweb%2Fwiklou.git Don't reinvent the wheel in SpecialRecentchangeslinked::getExtraOptions Just call parent::getExtraOptions() first and then simply add the one additional field. The 'SpecialRecentChangesPanel' hook wasn't called from SpecialRecentchangeslinked previously, I've wrapped the call in an if to keep the behavior the same. Changes this causes: * If $wgAllowCategorizedRecentChanges is true, Recentchangeslinked will include the category filter form as well. * The target filter on Recentchangeslinked will be displayed at the end of the form, below the tag filter. Change-Id: I4436a63356adb1e0b0daa1aa52c179974a036fa1 --- diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 0d6378cb86..1f10ad4c33 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -592,10 +592,6 @@ class SpecialRecentChanges extends IncludableSpecialPage { $defaults = $opts->getAllValues(); $nondefaults = $opts->getChangedValues(); - $opts->consumeValues( array( - 'namespace', 'invert', 'associated', 'tagfilter', - 'categories', 'categories_any' - ) ); $panel = array(); $panel[] = $this->optionsPanel( $defaults, $nondefaults ); @@ -664,6 +660,10 @@ class SpecialRecentChanges extends IncludableSpecialPage { * @return array */ function getExtraOptions( $opts ) { + $opts->consumeValues( array( + 'namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any' + ) ); + $extraOpts = array(); $extraOpts['namespace'] = $this->namespaceFilterForm( $opts ); @@ -677,7 +677,10 @@ class SpecialRecentChanges extends IncludableSpecialPage { $extraOpts['tagfilter'] = $tagFilter; } - wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) ); + // Don't fire the hook for subclasses. (Or should we?) + if ( $this->getName() === 'Recentchanges' ) { + wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) ); + } return $extraOpts; } diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index 062e09dadb..4773c4a327 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -226,21 +226,21 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges { } /** - * @param $opts FormOptions + * Get options to be displayed in a form + * + * @param FormOptions $opts * @return array */ function getExtraOptions( $opts ) { - $opts->consumeValues( array( 'showlinkedto', 'target', 'tagfilter' ) ); - $extraOpts = array(); - $extraOpts['namespace'] = $this->namespaceFilterForm( $opts ); + $extraOpts = parent::getExtraOptions( $opts ); + + $opts->consumeValues( array( 'showlinkedto', 'target' ) ); + $extraOpts['target'] = array( $this->msg( 'recentchangeslinked-page' )->escaped(), Xml::input( 'target', 40, str_replace( '_', ' ', $opts['target'] ) ) . Xml::check( 'showlinkedto', $opts['showlinkedto'], array( 'id' => 'showlinkedto' ) ) . ' ' . Xml::label( $this->msg( 'recentchangeslinked-to' )->text(), 'showlinkedto' ) ); - $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] ); - if ( $tagFilter ) { - $extraOpts['tagfilter'] = $tagFilter; - } + return $extraOpts; }