Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / url_outbound_alter.twig
1 /**
2  * Implements hook_url_outbound_alter().
3  */
4 function {{ machine_name }}_url_outbound_alter(&$path, &$options, $original_path) {
5   // Use an external RSS feed rather than the Drupal one.
6   if ($path == 'rss.xml') {
7     $path = 'http://example.com/rss.xml';
8     $options['external'] = TRUE;
9   }
10
11   // Instead of pointing to user/[uid]/edit, point to user/me/edit.
12   if (preg_match('|^user/([0-9]*)/edit(/.*)?|', $path, $matches)) {
13     global $user;
14     if ($user->uid == $matches[1]) {
15       $path = 'user/me/edit' . $matches[2];
16     }
17   }
18 }