wiki.techinc.nl/includes/ResourceLoader/Hook/ResourceLoaderModifyStartupSourceUrlsHook.php
Gergő Tisza 074554137d
resourceloader: Fix ResourceLoaderModifyStartupSourceUrls hook docs
Follows up I199ab779abd0596b836ae43dcc5f2f2a489c9274.

Change-Id: Id7282be6b2cdb34ff9307f532cb445e19a10f069
2024-08-01 10:56:28 +02:00

35 lines
1.3 KiB
PHP

<?php
namespace MediaWiki\ResourceLoader\Hook;
use MediaWiki\ResourceLoader\Context;
/**
* This is a hook handler interface, see docs/Hooks.md.
* Use the hook name "ResourceLoaderForeignApiModules" to register handlers implementing this interface.
*
* @stable to implement
* @ingroup ResourceLoaderHooks
*/
interface ResourceLoaderModifyStartupSourceUrlsHook {
/**
* Allow modifying source URLs (i.e. URLs to load.php, see {@link ResourceLoader::getSources()})
* before they get embedded in the JS generated for the startup module.
*
* The hook must not add or remove sources, and calling the new URL should have a roughly
* similar outcome to calling the old URL. It is mainly intended to preserve URL modifications
* that might affect the code generated for the modules (e.g. when load.php?modules=startup is
* called on the mobile site, it should generate source URLs which also use the mobile site).
*
* This hook is called from StartUpModule.
*
* @since 1.43
*
* @param string[] &$urls An array of source name => URL; the URL might be relative.
* @param Context $context
* @return void This hook must not abort, it must return no value
*/
public function onResourceLoaderModifyStartupSourceUrls( array &$urls, Context $context ): void;
}