From 0088c506bb86d93055a4a335f78ed74c3a754173 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 14 Nov 2013 17:54:19 +0100 Subject: [PATCH] resourceloader: Refactor module links output Changes: * Removed hardcoded logic in OutputPage regarding modules being "enabled". Previously we would always output state=loading and use $wgAllowUserJs (and others) to decide whether to output state=ready or makeResourceLoaderLink. Now, we no longer unconditionally output state=loading and simply always call makeResourceLoaderLink. That method takes care of checking whether modules are enabled and non-empty and returns state=ready when that is the case. This cleans up cases where the duplicated and incomplete logic in OutputPage thought the module was non-empty but turned out to be empty and thus would output both state=loading and later state=ready for the same module. * Clean up documentation for makeResourceLoaderLink (inconsistent ordering of type hint and $var, and @return was missing the fact that the returned html can also contain ). * makeResourceLoaderLink now returns an array of html and module states. This allows the consumer of this method to combine the states in 1 larger script tag on top of multiple makeResourceLoaderLink calls (e.g. one state script followed by multiple