summaryrefslogtreecommitdiff
path: root/modules/path/path.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/path/path.module')
-rw-r--r--modules/path/path.module10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/path/path.module b/modules/path/path.module
index 98ac778b8..0211ad910 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -137,7 +137,7 @@ function path_link($type, $node = NULL) {
}
}
-function path_nodeapi($node, $op, $arg) {
+function path_nodeapi(&$node, $op, $arg) {
if (user_access("create url aliases") || user_access("administer url aliases")) {
switch ($op) {
@@ -165,6 +165,14 @@ function path_nodeapi($node, $op, $arg) {
return form_textfield(t("Path alias"), "path", $node->path, 60, 250, t("Optionally specify an alternative URL by which this node can be accessed. For example, type 'about' when writing an about page. Use a relative path and don't add a trailing slash or the URL alias won't work.") . theme_error($arg["path"]));
case "insert":
+ /*
+ ** Don't try to insert if path is NULL. We may have already set
+ ** the alias ahead of time.
+ */
+ if ($node->path) {
+ path_set_alias("node/view/$node->nid", $node->path);
+ }
+ break;
case "update":
path_set_alias("node/view/$node->nid", $node->path);
break;