From feb4ffcf7215bfdc87677b2ac89d91a5306cc1fe Mon Sep 17 00:00:00 2001 From: MatmaRex Date: Mon, 20 May 2013 14:00:52 +0200 Subject: [PATCH] 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 --- includes/specials/SpecialRecentchanges.php | 13 ++++++++----- includes/specials/SpecialRecentchangeslinked.php | 16 ++++++++-------- 2 files changed, 16 insertions(+), 13 deletions(-) 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; } -- 2.20.1