Display Options: renderSettings null in the controller

Vote:
 

Hi,

I'm trying to do some tests with Display Options on our site and it seems that even if I choose any display option on a block in our CMS, I don't get the chosen value in the block controller.

Here's the initialization module where we add the options:

[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class DisplayRegistryInitialization : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
if (context.HostType == HostType.WebApplication)
{
// Register Display Options
var options = ServiceLocator.Current.GetInstance();
foreach (var optionId in options.Select(x => x.Id).ToArray())
{
options.Remove(optionId);
}

options
.Add("full", DisplayOptionTags.FullWidth, "full", "Full screen", "epi-icon__layout--full")
.Add("wide", DisplayOptionTags.TwoThirdsWidth, "wide", "Large (2 thirds)", "epi-icon__layout--two-thirds")
.Add("half", DisplayOptionTags.HalfWidth, "half", "Half", "epi-icon__layout--half")
.Add("narrow", DisplayOptionTags.OneThirdWidth, "narrow", "Narrow (1 third)", "epi-icon__layout--one-third")
.Add("quarter", DisplayOptionTags.OneFourthWidth, "quarter", "1 quarter", "epi-icon__layout--one-fourth");
}
}

Now when I select a block in a contentArea in the CMS, I can select my options in Display As. But even if I choose one of the options and publish the block, in the block controller, renderSettings is always null.

Here's the code I use to access my display option(tag):

var renderSettings = this.ControllerContext.RouteData.Values["renderSettings"] as Dictionary;

In  this.ControllerContext.RouteData.Values, I see the key "renderSettings" but the value is always null even if I chose a display option on a block.

Am I missing something?

#188658
Feb 28, 2018 15:50
Vote:
 

hi,

do you receive set display options in view fo the block instead? I can't remember correctly whether all the rendering info was passed down to the controller of the block. But I recall (when developing bootstrap area renderer plugin) that there was some weird error about how Episerver is treating tag & display options. latter was overwritting set tag.. code fragment here: https://github.com/valdisiljuconoks/EPiBootstrapArea/blob/master/src/EPiBootstrapArea/BootstrapAwareContentAreaRenderer.cs#L151

#189705
Mar 23, 2018 8:38
Vote:
 

Yan, did you resolve this? I'm having the exact same problem

#191238
Apr 24, 2018 14:21
Vote:
 

which versions are you guys running on? I can confirm that could not repoduce this is latest (11.6). anything special about your project? alloy works as expected.

#192191
May 09, 2018 14:24
* 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.