Skip to content

Commit

Permalink
Xpath Query on Multinode Treepicker no longer working for new Nodes (u…
Browse files Browse the repository at this point in the history
…mbraco#15159)

* fix for umbraco#14698

* Adjust XPath logic so it uses parentId as $current only when nodeContextId is null or 0

---------

Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
  • Loading branch information
huzzi and lauraneto authored Mar 6, 2024
1 parent ce769ff commit 3344274
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ public static string ParseXPathQuery(
});
}

// These parameters must have a node id context
if (nodeContextId.HasValue)
if (nodeContextId.HasValue || parentId.HasValue)
{
var currentId = nodeContextId.HasValue && nodeContextId.Value != default ? nodeContextId.Value : parentId.GetValueOrDefault();
vars.Add("$current", q =>
{
var closestPublishedAncestorId = getClosestPublishedAncestor(getPath(nodeContextId.Value));
var closestPublishedAncestorId = getClosestPublishedAncestor(getPath(currentId));
return q.Replace("$current", string.Format(rootXpath, closestPublishedAncestorId));
});
}
Expand Down

0 comments on commit 3344274

Please sign in to comment.