Try our conversational search powered by Generative AI!

How to find all blocks for current page in ContentArea or XHtmlString based on or inherited from FormContainerBlock

Vote:
 

How can I find all blocks that are or inherit from FormContainerBlock for current page in ContentArea or XHtmlString when page is saved? This would include existing pages/blocks OR when a page/block is created. I would like to set a page level property of ScaffoldColumn false.

This will be trigger when the _Layout @Html.RequiredClientResources(RenderingTags.Header) and @Html.RequiredClientResources(RenderingTags.Footer) are added. We don't want to add these unless they are being used. All of our pages are based on _Layout and as such not all will utilize epi Forms.

The tricky part is that a block my have a child block so recurrion might be needed.

#200161
Jan 03, 2019 23:25
Vote:
 

The point of 

@Html.RequiredClientResources(RenderingTags.Header) and @Html.RequiredClientResources(RenderingTags.Footer)

Is that any scripts that are registered to in components should only be loaded in when they are needed when the RenderBody generates markup and the blocks anyhow so you shouldn't have it loading in all pages. We use this heavily so blocks with specific JS only load where needed. Are you sure everything is setup correctly?

#200207
Jan 04, 2019 18:11
Vote:
 

Make sure you're using a inherited template with renderbody such as http://www.herlitz.nu/2017/01/03/error-epi-is-not-defined-epiforms-is-not-defined/. This should if all setup correctly not be loaded scripts unless needed

#200208
Jan 04, 2019 18:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.