Manual:Hooks/OpenSearchUrls

From MediaWiki.org
Jump to navigation Jump to search
OpenSearchUrls
Available from version 1.13.0
Called when constructing the OpenSearch description XML. Hooks can alter or append to the array of URLs for search & suggestion formats.
Define function:
public static function onOpenSearchUrls( &$urls ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"OpenSearchUrls": "MyExtensionHooks::onOpenSearchUrls"
	}
}

For MediaWiki ≤1.25:

$wgHooks['OpenSearchUrls'][] = 'MyExtensionHooks::onOpenSearchUrls';
Called from:File(s): ../opensearch_desc.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:OpenSearchUrls extensions.

Details[edit]

  • &$urls: array of associative arrays with Url element attributes