I have a Rule set up that sends a mail to a certain user with a link to a certain node. This link is altered using hook_url_outbound_alter
to include additional details.
The problem is that hook_url_outbound_alter also alters the URL everywhere else. Closing an overlay on the node view page rewrites the URL, clearing the cache (admin toolbar + devel) on the node pages rewrites the URL and so on.
I already attempted to check for an absolute URL in $options
, but that does not solve the problems above.
function mymodule_url_outbound_alter(&$path, &$options, $original_path) {
if (preg_match('|^node/([0-9]*)|', $path, $matches) && $options['absolute'] {
$options['query']['parameter'] = $foo;
}
}
}
Can I use hook_url_outbound_alter()
to only alter URLs when it was invoked from a specific module or something?