You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which Umbraco version are you using? For example: 8.14.1 - don't just write v8
10.4.0
Bug summary
I have an issue where I am using Contentment [V4.4.1], in an Umbraco [v10.4.0] solution, and I am trying to set up a Contentment Data List property editor.
To do this, I am defining a class inheriting from IDataListSource to create a custom data source that I can access from within the CMS.
The issue comes when using the IContentmentContentContext within the GetItems method of that class, which I am injecting to the constructor.
The Umbraco solution is multi-tenant (2 sites in 1 CMS), and there are some shared content elements within the two sites. So, I wanted to create a content element, and have a "Background Colour" property, which when opened would detect the context of where it is being used within the content tree(s) and return different brand colours depending on which site it is being used on.
The issue I am experiencing is that when I try to access the context method like this:
If the Background Colour property is being used within an element type (IPublishedElement?), then the above line of code is always returned as null. It works as expected if I put the background colour property on the Content Type (IPublishedContent) - At the page level, rather than the element level.
There seems to be a bool out property for checking whether the item returned is a parent item or not. I would presume if I called this method from an IPublishedElement type, that it would return its parent IPublishContent type and out the isParent bool as true.
It just returns as null, and I can't figure out a way to get the context from Block List Editor content blocks.
Steps to reproduce
Base install of Umbraco 10.4.0
Create a Page type in the CMS
Install Contentment 4.4.1
Configure a class that inherits from IDataListSource
Inject the IContentmentContentContext to that class
Create a Block List Editor property and add it to your page in the CMS.
Create a data type that uses your new IDataListSource class
Create a element type and add this new data type to it.
Add the new element type to the Block List Editor data type
Add the page to the root and add the new element type within it.
Expected result / actual result
I would expect to get the context IPublishedContent back from the line:
Sorry to say, Block List (and Nested Content) doesn't work well with the IContentmentContentContext feature.
The reason being, when Block List makes the API call to get the element-type scaffolds, it passes through a parentId value of -20, (which is the recycle bin ID), so we can't get a contextual content node using that value.
@leekelleher After I sent the bug report and did some more reading I was coming to the conclusion that it wasn't a Contentment issue at all, and rather an Umbraco one.
Thanks for taking the time to reply, and for the links to other possible solutions.
Love using Contentment and install it on most projects now, looking forward to seeing where you take it next!
Follow up on this issue; a patch to resolve this for the Block List editor has been merged in, umbraco/Umbraco-CMS#15063, due for release in Umbraco v13.1.0.
Which Contentment version are you using?
4.4.1
Which Umbraco version are you using? For example: 8.14.1 - don't just write v8
10.4.0
Bug summary
I have an issue where I am using Contentment [V4.4.1], in an Umbraco [v10.4.0] solution, and I am trying to set up a Contentment Data List property editor.
To do this, I am defining a class inheriting from IDataListSource to create a custom data source that I can access from within the CMS.
The issue comes when using the IContentmentContentContext within the GetItems method of that class, which I am injecting to the constructor.
The Umbraco solution is multi-tenant (2 sites in 1 CMS), and there are some shared content elements within the two sites. So, I wanted to create a content element, and have a "Background Colour" property, which when opened would detect the context of where it is being used within the content tree(s) and return different brand colours depending on which site it is being used on.
The issue I am experiencing is that when I try to access the context method like this:
IPublishedContent? currentNode = contentmentContentContext.GetCurrentContent(out bool isParent);
If the Background Colour property is being used within an element type (IPublishedElement?), then the above line of code is always returned as null. It works as expected if I put the background colour property on the Content Type (IPublishedContent) - At the page level, rather than the element level.
There seems to be a bool out property for checking whether the item returned is a parent item or not. I would presume if I called this method from an IPublishedElement type, that it would return its parent IPublishContent type and out the isParent bool as true.
It just returns as null, and I can't figure out a way to get the context from Block List Editor content blocks.
Steps to reproduce
Expected result / actual result
I would expect to get the context IPublishedContent back from the line:
IPublishedContent? currentNode = contentmentContentContext.GetCurrentContent(out bool isParent);
And would expect the isParent property to return true, indicating that it had gotten the context from the elements parent page.
But what actually happens is the above currentNode property is null.
Do you have Umbraco ModelsBuilder enabled?
What browsers are you seeing the problem on?
Chrome
The text was updated successfully, but these errors were encountered: