D_Inventor
08/15/2023, 6:28 AMnzdev
08/15/2023, 6:36 AMD_Inventor
08/15/2023, 7:05 AMD_Inventor
08/15/2023, 7:12 AMMatt Wise
08/15/2023, 8:06 AMD_Inventor
08/15/2023, 8:10 AMIsContainer
flag to false if the node was of the right type and was in the roothuwred
08/15/2023, 9:38 AMhuwred
08/15/2023, 9:44 AMD_Inventor
08/15/2023, 9:45 AMIsContainer
flag to false on the root node of the forum. That seems to do the trick.D_Inventor
08/15/2023, 10:29 AMcsharp
public class DecoratorEntityServiceListViewDisabler : IEntityService
{
private readonly IEntityService _decoratee;
public DecoratorEntityServiceListViewDisabler(IEntityService decoratee)
{
_decoratee = decoratee;
}
// ... implement interface through _decoratee
public IEntitySlim? Get(int id, UmbracoObjectTypes objectType)
{
var result = _decoratee.Get(id, objectType);
if (objectType == UmbracoObjectTypes.Document && result is DocumentEntitySlim resultDocument && resultDocument.ParentId == -1)
{
// Disable isContainer
resultDocument.IsContainer = false;
}
return result;
}
public IEntitySlim? Get(Guid key, UmbracoObjectTypes objectType)
{
var result = _decoratee.Get(key, objectType);
if (objectType == UmbracoObjectTypes.Document && result is DocumentEntitySlim resultDocument && resultDocument.ParentId == -1)
{
// Disable isContainer
resultDocument.IsContainer = false;
}
return result;
}
}
huwred
08/15/2023, 1:06 PMA hub and casual space for you to interact with fellow community members and learn more about Umbraco!
Powered by