Contentment - IContentmentContentContext not returning node when used within Block List Editor
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.
Has anyone experienced this issue?
Does anyone have a solution for context injection that works at the element level?
Contentment - IContentmentContentContext not returning node when used within Block List Editor
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.
Has anyone experienced this issue?
Does anyone have a solution for context injection that works at the element level?
The docs seem to suggest that you can access context from the element level - https://github.com/leekelleher/umbraco-contentment/blob/develop/docs/editors/data-list.md#accessing-contextual-content
Any help would be greatly appreciated. Thanks.
if you upgrade to latest version (5.0.2), it works fine
is working on a reply...