Manual:Hooks/SpecialSearchGoResult
SpecialSearchGoResult | |
---|---|
Available from version 1.27.0 Called before the 'go' feature of SpecialSearch redirects a user. May provide it's own url to redirect to. |
|
Define function: |
public static function onSpecialSearchGoResult( $term, Title $title, &$url ) { ... }
|
Attach hook: |
In extension.json: {
"Hooks": {
"SpecialSearchGoResult": "MyExtensionHooks::onSpecialSearchGoResult"
}
}
For MediaWiki ≤1.25: $wgHooks['SpecialSearchGoResult'][] = 'MyExtensionHooks::onSpecialSearchGoResult';
|
Called from: | File(s): SpecialSearch.php |
For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:SpecialSearchGoResult extensions.
DescriptionEdit
If a hook returns false the 'go' feature will be canceled and a normal search will be performed. Returning true without setting $url does a standard redirect to $title. Setting $url redirects to the specified URL.
DetailsEdit
$term - The string the user searched for
$title - The title the 'go' feature has decided to forward the user to
&$url - Initially null, hook subscribers can set this to specify the final url to redirect to