Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Restriction of DisplayOptions tag not working

$
0
0

Hi,

I am using multiple display options on my website and am trying to set up a block so that it only uses one of the display options. I have got the following display options set:

    public class SungardDisplayOptionsProvider : IDisplayOptionsProvider
    {
        public const string FullWidthTag = "full";
        public const string OneHundredTag = "100";
        public const string SeventyTag = "70";
        public void InitializeOptions(EPiServer.Web.DisplayOptions options)
        {
            options
            .Add("full", "/displayoptions/full", FullWidthTag, string.Empty, "epi-icon__layout--full")
            .Add("onehundred", "/displayoptions/onehundred", OneHundredTag, string.Empty, "epi-icon__layout--full")
            .Add("seventy", "/displayoptions/seventy", SeventyTag, string.Empty, "epi-icon__layout--full")
            .Add("fifty", "/displayoptions/fifty", ContentAreaDisplayOptions.Fifty, string.Empty, "epi-icon__layout--one-third")
            .Add("thirty", "/displayoptions/thirty", ContentAreaDisplayOptions.Thirty, string.Empty, "epi-icon__layout--one-third")
            .Add("twentyfive", "/displayoptions/twentyfive", ContentAreaDisplayOptions.TwentyFive, string.Empty, "epi-icon__layout--quarter");
        }
    }

In my TemplateCoordinator I do the following:

        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            viewTemplateModelRegistrator.Add(typeof(CaseStudyFullWidthTextBlock), new TemplateModel
            {
                Tags = new[] { SungardDisplayOptionsProvider.FullWidthTag },
                AvailableWithoutTag = false,
                Path = BlockPath("CaseStudyFullWidthText.cshtml"),

            });

However, when I look at the CMS, I can see the following:

"The block 'Full width text block' cannot be displayed as /displayoptions/onehundred

The block 'Full width text block' cannot be displayed as /displayoptions/thirty

The block 'Full width text block' cannot be displayed as /displayoptions/seventy

The block 'Full width text block' cannot be displayed as /displayoptions/fifty

The block 'Full width text block' when displayed as /displayoptions/full

The 'CaseStudyFullWidthTextBlock' can not be displayed using the 'Full' display option

The block 'Full width text block' cannot be displayed as /displayoptions/twentyfive"

As you can see, it looks like it's trying to display the display option with the "full" tag as requested, but for some reason it can't. Even more strangely, If I set AvailableWithoutTag to true, all the views get rendered correctly for the block, including "full". This leads me to think there is a bug in episerver (I'm using version 9), but maybe i'm missing something?

Thanks for any help,

Sam


Viewing all articles
Browse latest Browse all 9076

Trending Articles