Try our conversational search powered by Generative AI!

AreaContentRenderer Ctor does not take IContentAreaItemAttributeAssembler


I need to overrid the ContentAreaRenderer to implement DisplayOptions on all templates.

I need the display option to render in the ContentArea so that it will affect all templates.

Ive tried to implement this solution

What goes wrong I get the error "ContentFragmentAttributeAssembler is obsolete use IContentAreaItemAttributeAssembler instead" When i change the type i get a problem because of the base constructor does not take en IContentAreaItemAttributeAssembler but rather the obsolete ContentFragmentAttributeAssembler

 public class ContentAreaRendererWithDisplayOptionWithCss : ContentAreaRenderer
        private readonly DisplayOptions _displayOptionsOwn;
        private readonly IContentRepository _contentRepositoryOwn;
        public ContentAreaRendererWithDisplayOptionWithCss()
            : this(

        public ContentAreaRendererWithDisplayOptionWithCss(
            IContentRenderer contentRenderer, 
            TemplateResolver templateResolver, 
            IContentAreaItemAttributeAssembler attributeAssembler, 
            IContentRepository contentRepository, 
            DisplayOptions displayOptions)
            : base(contentRenderer, 
            _displayOptionsOwn = displayOptions;
            _contentRepositoryOwn = contentRepository;

Jul 26, 2017 14:39

Which version of epi you are using? I see constructor with `IContentAreaItemAttributeAssembler` type.

If you need to capture `DisplayOptions` just stick with existing constructor (even it receives `ContentFragmentAttributeAssembler`) but call base constructor with `IContentAreaItemAttributeAssembler` received from `ServiceLocator`.

Just out of curiousity - what you trying to achieve with custom CA renderer? Why you need to "preserve" passed in display options?

Jul 30, 2017 22:29

@Valdis: Thanks for your time! I am using CMS 10.10.1. 

Im trying to implement custom display options. Maybe i got this wrong but i thought i need to render the display options into the view. And since i want the custom display options in all views i thought i need to make sure they render in the Content Area wrapping the view. No? 

Im guessing by your answer that im not aproaching this correctly. What is your suggestion?

Jul 31, 2017 10:51

"need to render display options into the view".. sorry but it's still a bit unclear on exact requirements here. I'm sure whether you approach problem from right or wrong angle, that's why I'm asking :)

I've been playing around with display options a lot. You can take a look at episerver bootstrap area renderer (don't afraid of "bootstrap" nowadays that lib has less and less in common with bootstrap). It's more like general contributions to EPiSerer Content Area. Maybe you can find solution there..

Jul 31, 2017 13:00

Thank you for asking, it means you are not giving up on me. :D

Ill explain what i think i understand how this works. And then maybe you can see if i am missunderstanding it. 

Basically the requirement is to give the editor the option to render the content of a CA with any CSS-classes that we want wrapped around it. Ive understood that custom DisplayOptions can do this but we need to extend the DisplayOptions to include a CSS-class and also extend the ContentAreaRenderer to use this new css class. 

Im following this

And when i do i get problems cause the type of some of the parameters in the constructor gets marked as obsolete, and when i change them to the new type the base class constructor wont work. 

Does this make sense? 

Jul 31, 2017 14:33

Makes sense, but then I would go with ordinary custom css class support from this package. You can read more here:

Jul 31, 2017 15:19
* 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.