November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
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
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?