From: Mark A. Hershberger Date: Tue, 2 Aug 2011 14:27:48 +0000 (+0000) Subject: Fixes Bug #29311 - [OutputPage] Create a method to remove items from mModules X-Git-Tag: 1.31.0-rc.0~28488 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=4aab309880b981c7334fb94944b8dfd0880a744d;p=lhc%2Fweb%2Fwiklou.git Fixes Bug #29311 - [OutputPage] Create a method to remove items from mModules Patch from John Du Hart, reviewed by Roan, Applying at Roan's request. --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 892b4f5e4f..7808552951 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -440,6 +440,22 @@ class OutputPage extends ContextSource { $this->mModules = array_merge( $this->mModules, (array)$modules ); } + /** + * Remove one or more modules recognized by the resource loader. + * + * @param $modules Mixed: module name (string) or array of module names + */ + public function removeModules( $modules ) { + $this->mModules = array_diff( $this->mModules, (array)$modules ); + } + + /** + * Removes all modules for resource loader. + */ + public function resetModules() { + $this->mModules = array(); + } + /** * Get the list of module JS to include on this page * @@ -2571,7 +2587,7 @@ $templates } else { # @todo FIXME: This means that User:Me/Common.js doesn't load when previewing # User:Me/Vector.js, and vice versa (bug 26283) - + // We can't do $userScripts[] = 'user'; because the user module would end up // being wrapped in a closure, so load it raw like 'site' $scripts .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS );