X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fchi-teck%2Fdrupal-code-generator%2Ftemplates%2Fd7%2Fhook%2Furl_outbound_alter.twig;fp=vendor%2Fchi-teck%2Fdrupal-code-generator%2Ftemplates%2Fd7%2Fhook%2Furl_outbound_alter.twig;h=903a608bb191f7354c307e4d0b5f6e9d8375a778;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=0000000000000000000000000000000000000000;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/url_outbound_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/url_outbound_alter.twig new file mode 100644 index 000000000..903a608bb --- /dev/null +++ b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/url_outbound_alter.twig @@ -0,0 +1,18 @@ +/** + * Implements hook_url_outbound_alter(). + */ +function {{ machine_name }}_url_outbound_alter(&$path, &$options, $original_path) { + // Use an external RSS feed rather than the Drupal one. + if ($path == 'rss.xml') { + $path = 'http://example.com/rss.xml'; + $options['external'] = TRUE; + } + + // Instead of pointing to user/[uid]/edit, point to user/me/edit. + if (preg_match('|^user/([0-9]*)/edit(/.*)?|', $path, $matches)) { + global $user; + if ($user->uid == $matches[1]) { + $path = 'user/me/edit' . $matches[2]; + } + } +}