From 4aab309880b981c7334fb94944b8dfd0880a744d Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Tue, 2 Aug 2011 14:27:48 +0000 Subject: [PATCH] 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. --- includes/OutputPage.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 ); -- 2.20.1