function custom_url_rewrite_outbound
6.x core.php | custom_url_rewrite_outbound(&$path, &$options, $original_path) |
custom_url_rewrite_outbound is not a hook, it's a function you can add to settings.php to alter all links generated by Drupal. This function is called from url(). This function is called very frequently (100+ times per page) so performance is critical.
This function should change the value of $path and $options by reference.
Parameters
$path: The alias of the $original_path as defined in the database. If there is no match in the database it'll be the same as $original_path
$options: An array of link attributes such as querystring and fragment. See url().
$original_path: The unaliased Drupal path that is being linked to.
Related topics
1 call to custom_url_rewrite_outbound()
- url in drupal-6.x/
includes/ common.inc - Generates an internal or external URL.
1 string reference to 'custom_url_rewrite_outbound'
- url in drupal-6.x/
includes/ common.inc - Generates an internal or external URL.
File
- documentation-6.x/
developer/ hooks/ core.php, line 2753 - These are the hooks that are invoked by the Drupal core.
Code
function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
global $user;
// Change all 'node' to 'article'.
if (preg_match('|^node(/.*)|', $path, $matches)) {
$path = 'article' . $matches[1];
}
// Create a path called 'e' which lands the user on her profile edit page.
if ($path == 'user/' . $user->uid . '/edit') {
$path = 'e';
}
}