- Bugfix: pass the node by reference in path_nodeapi so that $node->path is set
for the node. Fixes bug #3680. Patch by Matt. - Bugfix: when creating a new node, don't try to insert a path if it wasn't set in the node form. This destroys any paths which the user may have created ahead of time for that node. Patch by Matt.4.3.x
parent
880842885b
commit
3c3c556c55
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue