Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi,
Maybe you could register your own ContentArea renderer
private static void ConfigureContainer(ConfigurationExpression container) { container.For<ContentAreaRenderer>().Use<AlloyContentAreaRenderer>(); } public class AlloyContentAreaRenderer : ContentAreaRenderer { protected override void RenderContentAreaItems(HtmlHelper htmlHelper, IEnumerable<ContentAreaItem> contentAreaItems) { var maxElements = htmlHelper.ViewContext.ViewData["maxElements"]; if (maxElements != null) { contentAreaItems = contentAreaItems.Take((int)maxElements); } base.RenderContentAreaItems(htmlHelper, contentAreaItems); } }
I didnt test this code.
Hi,
is there a way to limit the number (e.g. max 10) of content area items to render without using a valdiation.
Thanks