Closed bjarnef closed 3 years ago
Using $root
solve it in the use-case though :)
@bjarnef Tricky to say whether it's a bug or by design, as Umbraco's UmbracoXPathPathSyntaxParser.ParseXPathQuery
method is attempting to replace the XPath's $
tokens with the ID of the closest content item. Then when used on a member, there is no context of the content to use.
Here's how the Umbraco Content data-source is attempting to get the contextual ID; https://github.com/leekelleher/umbraco-contentment/blob/1.4.4/src/Umbraco.Community.Contentment/DataEditors/DataList/DataSources/UmbracoContentDataListSource.cs#L80
...and here's how Umbraco's UmbracoXPathPathSyntaxParser
replaces the tokens;
https://github.com/umbraco/Umbraco-CMS/blob/release-8.6.1/src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs#L70-L100
Like you say, $root
will always work, as it doesn't need a contextual ID.
I'm not sure what I could do to make it work in the Media/Members sections. Open to suggestions.
Best I can do at the moment is to make a note of it in the known issues on the README.
@leekelleher yeah, Media and Member section need the contextual ID, but not sure what the request returns here, when not request is made from content section.
In case you only have a single root node in content section it could specifically use this or when request is made from media/member section. However I am note sure what happens if the picker is opening in infinite mode in media/member. I think the editorState
, e.g. editorState.current
as in this PR https://github.com/umbraco/Umbraco-CMS/pull/10966
Sometimes you may have multiple root nodes, but actually only a single site node. Not sure thereΒ΄s a good way to cover this scenario.
@leekelleher with "Umbraco Content" data source we can set the parent node, but is there a way to limit to a specific node type like MNTP?
E.g. I have this structure:
Using the XPath $site//brandArchive
shows both "Brand A + B" and "Brand Location" nodes, but I wan't the filter to only select "Brand Location" nodes.
Or would I need to add a custom data source for this?
Using the XPath
$site//brandArchive
shows both "Brand A + B" and "Brand Location" nodes, but I wan't the filter to only select "Brand Location" nodes.
@bjarnef From the structure you mentioned, that doesn't sound correct. The "Umbraco Content" data-source should only list the direct child nodes, not the descendants. π So I'm not sure why the "Brand Location" nodes are being displayed.
With your question about filtering on DocType, it currently doesn't have that feature, but it could be a potential feature request. π
In the meantime, you could try the "Umbraco Content by XPath" data-source (unless if you can't, e.g. Media/Members)? or a custom data-source.
@leekelleher yeah, however I don't want to show direct children more the descendant "Brand Location" nodes. Or is is okay the show "Brand" nodes, they should just be disabled.
I tried with $site//brandArchive/brandEntity
but only shows children og first brand.
It doesn't seem I have a ""Umbraco Content by XPath" data-source as this it Contentment v1.4.4 - maybe it was added later?
I can probably implement a custom data source and include "Brand Location" nodes. Maybe there a "Group" option? It could be nice the group these by parent node, e.g. similar to this picker in Vendr (not necessarily with the option to "select parent / select all"), but more the grouping. Could be useful e.g. in a "Region Picker" ππ
It doesn't seem I have a ""Umbraco Content by XPath" data-source as this it Contentment v1.4.4 - maybe it was added later?
It was originally added as a hidden data-source in v1.4.0 - see the secret notes π€« part on how to enable it. It was latest unhidden (available for all) in v2.1.0, and the Group
property was added too.
re: native grouping, I did start work on Data List grouping, see discussion #90 - but the AngularJS parts got quite tricky with some of the list-editors.
Cool, I must have missed that part and have mostly worked with Contentment v1. Would be great to use a newer version of Contentment, but for now the project is still on Umbraco v8.13.1
For now I think a custom data source using Internal og External examine index may be good enough π
The main reason for the Umbraco dependency bump was to do with the <umb-icon>
directive, (and v8.14 was the latest at the time). Always tricky for a package developer to balance progress/enhancements with maintenance/support. π¬
For now I think a custom data source using Internal og External examine index may be good enough π
Feel free to reuse what you need from the Examine data-source - if it helps? e.g. https://github.com/leekelleher/umbraco-contentment/blob/dev/v2.x/src/Umbraco.Community.Contentment/DataEditors/DataList/DataSources/ExamineDataListSource.cs
Closing off this issue, (as per the original query). As mentioned above, https://github.com/leekelleher/umbraco-contentment/issues/184#issuecomment-963215362, the "Umbraco Content" data-source was (limited) designed to work within the Content section.
Which Contentment version are you using?
1.4.4
Which Umbraco version are you using? For example: 8.14.1 - don't just write v8
8.13.1
Bug summary
Not sure if this is a bug in Contentment as it is also the behaviour with MNTP.
When using Umbraco Content data source on a member, the data list doesn't show any data. This is probably because it doesn't know about the context. I can probably use
$root
instead of$site
when we know only a single site node is used:I suggested this some time ago to make MNTP work on Media and Member types, when current section is not Content section: https://github.com/umbraco/Umbraco-CMS/pull/10049
Steps to reproduce
Create a datatype using Data List and Umbraco Content as datasource. Specify Xpath query using
$site
and add a property to a member type using this datatype.When "Add" on member property no content is shown in overlay.
Expected result / actual result
No response
Do you have Umbraco ModelsBuilder enabled?
What browsers are you seeing the problem on?
No response