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
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 (file)
index 0000000..903a608
--- /dev/null
@@ -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];
+    }
+  }
+}