Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make XPATH filter work when MNTP is placed on a member/media type #9917

Closed
Ric-Carey opened this issue Mar 1, 2021 · 7 comments
Closed

Make XPATH filter work when MNTP is placed on a member/media type #9917

Ric-Carey opened this issue Mar 1, 2021 · 7 comments

Comments

@Ric-Carey
Copy link

Hi,

Noticed this on v8.6.3 to might not be relevant any more but:

If you put an xpath query in a multi-node picker to determine what nodes are shown, when you pick that MNTP on a Member, it doesn’t recognise the filter and just shows the full tree. Explicitly choosing the node, works but the xpath isn’t recognised despite it working on the content tree side of things. Its probably something to do with context but really it should be consistent across sections.

Cheers
Ric

@nul800sebastiaan
Copy link
Member

Yeah it looks like when you put an MNTP on a member type, it doesn't have the proper context. The MNTP was originally only built to work on content items. I would assume it also doesn't work if you put it on a media item.

We'd be happy to look at a fix if possible! It's been like this forever and I don't remember anyone else asking for this so maybe don't spend a ton of time on it if it turns out it's super complicated.

@nul800sebastiaan nul800sebastiaan changed the title Start node filter on MNTP not recognised on members Make XPATH filter work when MNTP is placed on a member/media type Mar 1, 2021
@umbrabot
Copy link

umbrabot commented Mar 1, 2021

Hi @Ric-Carey,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post

Thanks muchly, from your friendly Umbraco GitHub bot :-)

@bjarnef
Copy link
Contributor

bjarnef commented Mar 23, 2021

I think the main issue here it that it use $routeParams.id which is the current node id (a bit misleading the variable is named rootId).
https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js#L243

I think when an XPath query is configurated we can assume it should always use content or media as XPath doesn't work with members. Actually not sure if XPath is supported on media in Umbraco v8 - at least UmbracoHelper only has ContentAtXPath() and ContentSingleAtXPath(). Generally Xpath isn't necessary in v8, but used a few places to support XPath on MNTP.

Anyway I think we can assume XPath should only work on content since this current entityResource.getByQuery() in ContentPicker / MNTP only lookup Document entity type.

In content section you know what $site and $root is, but in media and members section you don't know what $site as you can have several site nodes.

@bjarnef
Copy link
Contributor

bjarnef commented Mar 23, 2021

@bjarnef
Copy link
Contributor

bjarnef commented Mar 23, 2021

Not fixing all use-cases, but a enhancement when you only have a single node at root 👍
#10049

@umbrabot
Copy link

Closing this in relation to PR #10049 - make sure to read the close reason on #10049

@umbrabot
Copy link

Closing this in relation to PR #10052 - make sure to read the close reason on #10052

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants