12 votesLee commented
I've found a slightly simpler solution to this than was given in the ticket.
The key to the whole thing was this method, derived from the code Kentico sent me...
private static bool IsKenticoEmbeddedView(string viewName)
return (viewName.StartsWith("~/", StringComparison.Ordinal))
&& viewName.IndexOf("Kentico/", StringComparison.OrdinalIgnoreCase) >= 0;
Once I knew that the issue was with the "embedded" views and what constituted a Kentico "embedded" view I just needed to have my custom View Engine (which inherits directly from RazorViewEngine) return an empty result for those cases - which allows MVC to fall back to the next view engine in line - Kentico's - for those requests.
My working custom view engine can be seen here: https://pastebin.com/kXWqDYC7
To allow the fallback to Kentico's view engine to work properly, it must be registered in Global.asax after the Kentico features "Use" methods have been called. Possibly also after the CmsRegistrationSource has been registered with DI too, I've not tested that bit.
This method means that we're not fully overriding the Kentico view engine, just popping our own in front of it in the view resolution process. This should minimise the possibility of any future updates causing problems providing the above IsKenticoEmbeddedView rules don't change.
thanks for the suggestion! Based on the feedback we received, we are exploring this addition to the Page builder. Can you please share how important the following features are to you?
1. The possibility to specify allowed sections per editable area
2. The possibility to specify the number of sections that can be added to an editable area
3. The possibility to specify allowed widgets per section
As an addition to this, also restrict whether additional sections can be added.
Waiting for more votes.
56 votesShare your thoughts · 10 comments · Kentico Product Ideas » Platform · Flag idea as inappropriate… · Admin →
72 votesShare your thoughts · 7 comments · Kentico Product Ideas » Content Management · Flag idea as inappropriate… · Admin →
326 votesShare your thoughts · 9 comments · Kentico Product Ideas » Content Management · Flag idea as inappropriate… · Admin →