Try our conversational search powered by Generative AI!
AI OnAI Off
I have never tried the approach but you might be able to use virtual roles (http://world.episerver.com/documentation/Class-library/?documentId=cms/8/1B4BB538):
It may work, let me know how you get on!
Thank you for the suggestion - I took a look at the virtual roles and on the surface it does seem to be possible going down that route.
I did however begin to struggle with context and trying to determine whether I was on the "allowed pages" when validating the role, so I decided against it for performance issues.
So for now - I'll handle it in the descriptions and by making sure the code doesn't crash if invalid combinations are used (blocks require specific page data to exists and so on).
Thank you anyway for the suggestion.
Hi everybody.
I have a site which contains Page -> Blocks (Level 1) -> Blocks (Level 2)
And it works quite well - however, I'm running into a situation where I'd like to extend AllowedTypes for a block ContentArea.
I've seen that AllowedTypes are basically just an ValidateAttribute, so I should be able to build my own additional validation as well to determine valid blocks;
however - that means the blocks that are invalid according to my logic are still shown in the cms editor when creating a new block for a Content Area.
So I'm looking for whether it's possible to extending/overrule the function that lists Allowed blocks or extending the AllowedTypes IsValid functionality?
Basically - what I'm after is that some Block types are only valid on some Level 2 if they're on a specific Page. And if I'm going to solve that using AllowedType, I'll need to duplicate my Level 1 blocks or start assigning the AllowedTypes programmatically.
So I'm thinking simply adding an additional validation would be easiest, *if* I could also remove them from the shown list in cms edit.