| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\ResourceLoader\Hook; |
| 4 | |
| 5 | /** |
| 6 | * This is a hook handler interface, see docs/Hooks.md. |
| 7 | * Use the hook name "ResourceLoaderModifyEmbeddedSourceUrls" to register handlers implementing this interface. |
| 8 | * |
| 9 | * @stable to implement |
| 10 | * @ingroup ResourceLoaderHooks |
| 11 | */ |
| 12 | interface ResourceLoaderModifyEmbeddedSourceUrlsHook { |
| 13 | |
| 14 | /** |
| 15 | * Allow modifying source URLs (i.e. URLs to load.php, see {@link ResourceLoader::getSources()}) |
| 16 | * when they are used for output that may be embedded in the page HTML, rather than referenced |
| 17 | * using `<link>` etc., and thus the URL will be expanded relative to index.php URLs, rather than |
| 18 | * other load.php URLs. |
| 19 | * |
| 20 | * The hook must not add or remove sources, and calling the new URL should have a roughly similar |
| 21 | * outcome to calling the old URL. It is mainly intended to support serving index.php and load.php |
| 22 | * from different domains. |
| 23 | * |
| 24 | * This hook is currently called from StartUpModule and ImageModule. |
| 25 | * |
| 26 | * @since 1.43 |
| 27 | * |
| 28 | * @param string[] &$urls An array of source name => URL; the URL might be relative. |
| 29 | * @return void This hook must not abort, it must return no value |
| 30 | */ |
| 31 | public function onResourceLoaderModifyEmbeddedSourceUrls( array &$urls ): void; |
| 32 | |
| 33 | } |