function hook_redirect_load_by_source_alter in Redirect 8
Same name and namespace in other branches
- 7.2 redirect.api.php \hook_redirect_load_by_source_alter()
- 7 redirect.api.php \hook_redirect_load_by_source_alter()
Alter the list of redirects matching a certain source.
Parameters
$redirects: An array of redirect objects.
$source: The source request path.
$context: An array with the following key/value pairs:
- language: The language code of the source request.
- query: An array of the source request query string.
See also
redirect_load_by_source()
Related topics
File
- ./
redirect.api.php, line 100 - Hooks provided by the Redirect module.
Code
function hook_redirect_load_by_source_alter(array &$redirects, $source, array $context) {
foreach ($redirects as $rid => $redirect) {
if ($redirect->source !== $source) {
// If the redirects to do not exactly match $source (e.g. case
// insensitive matches), then remove them from the results.
unset($redirects[$rid]);
}
}
}