function hook_url_inbound_alter in URL alter 6
Hook implementation of custom_url_rewrite_inbound().
Alter incoming requests so they map to a Drupal path.
This function can change the value of $result since it is passed by reference.
Please note that this function is called before modules are loaded and the menu system is initialized. After execution it changes the value of $_GET['q'].
If you want to implement this hook, your module should also make sure to implement hook_boot() so that your module is loaded at the time it will be invoked.
Parameters
$result: The Drupal path based on the database. If there is no match in the database it will be the same as $path.
$path: The path to be rewritten.
$path_language: An optional language code for the request.
1 function implements hook_url_inbound_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- url_alter_url_inbound_alter in ./
url_alter.module - Implementation of hook_url_inbound_alter().
1 invocation of hook_url_inbound_alter()
File
- ./
url_alter.api.php, line 56 - Documentation for url_alter API.
Code
function hook_url_inbound_alter(&$result, $path, $path_language) {
global $user;
// Change all requests for 'article/x' to 'node/x'.
if (preg_match('|^article(/.*)|', $path, $matches)) {
$result = 'node' . $matches[1];
}
// Change all requests to 'e' to the user's profile edit page.
if ($path == 'e') {
$result = 'user/' . $user->uid . '/edit';
}
}