November Happy Hour will be moved to Thursday December 5th.

AreaContentRenderer Ctor does not take IContentAreaItemAttributeAssembler

Vote:
 

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 https://world.episerver.com/blogs/Anders-Hattestad/Dates/2014/8/Extending-ContentArea-to-use-custom-CSS-class-on-child-elements/

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(
                  ServiceLocator.Current.GetInstance(), 
                  ServiceLocator.Current.GetInstance(), 
                  ServiceLocator.Current.GetInstance(), 
                  ServiceLocator.Current.GetInstance(), 
                  ServiceLocator.Current.GetInstance())
        {

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

    }
#180797
Jul 26, 2017 14:39
Vote:
 

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?

#180857
Jul 30, 2017 22:29
Vote:
 

@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?

#180867
Jul 31, 2017 10:51
Vote:
 

"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..

#180870
Jul 31, 2017 13:00
Vote:
 

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 

http://world.episerver.com/blogs/Anders-Hattestad/Dates/2014/8/Extending-ContentArea-to-use-custom-CSS-class-on-child-elements/

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? 

#180871
Jul 31, 2017 14:33
Vote:
 

Makes sense, but then I would go with ordinary custom css class support from https://github.com/valdisiljuconoks/EPiBootstrapArea this package. You can read more here: https://github.com/valdisiljuconoks/EPiBootstrapArea/blob/master/README.md#customize-generated-css-classes.

#180873
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.