Try our conversational search powered by Generative AI!

Is there any way to disable DisplayOptions for a ContentArea


Is there any way to disable all display options for a content area property so that the content is rendered with the pre-defined tag (Automatic).
To clarify, I am not talking about restricting certain display options to a type of content.

A property rendered with @Html.PropertyFor(m => m.CurrentPage.Pages, new { Tag = "Link" }) sets the "Automatic" display option to Link but still enables the editor to switch to another display option.
We simply want to turn off the option to "Display as" for a single content area.

Sep 18, 2015 11:46


If you don't set the display options somewhere in your initialization module, then options should not appear in ContentArea.

In Alloy solution there is DisplayRegistryInitialization initialization module. There is a code:

var options = ServiceLocator.Current.GetInstance<DisplayOptions>();
                    .Add("full", "/displayoptions/full", Global.ContentAreaTags.FullWidth, "", "epi-icon__layout--full")
                    .Add("wide", "/displayoptions/wide", Global.ContentAreaTags.TwoThirdsWidth, "", "epi-icon__layout--two-thirds")
                    .Add("narrow", "/displayoptions/narrow", Global.ContentAreaTags.OneThirdWidth, "", "epi-icon__layout--one-third");

I tried to remove this. The Display Options menu dissapeared. Is this what you need?

Sep 18, 2015 12:52

No not really, I still want my display options for most content areas, but disable them for a select few.

In other words, something like this would be best

public virtual ContentArea Pages { get; set; }
Sep 18, 2015 14:10

The Display Options list is global and used across all ContentAreas.

I prepared a solution for disabling Display Options for specific ContentAreas, but it's few files and need explanation.

First of all you need to turn off Display Options on property in Forms Editing view and in On Page view.

That's why you need to prepare EditorDescriptor.

To turn it off in Forms Editing you need to inherit from original editor and and skip SelectDisplayOption menu command. This one file change.

To change the overlay you need to inherit from original overlay, then in your overlay use custom block overlay. And in block overlay skip SelectDisplayOption menu command. 

I used public EPIServer client side API, so those are not hack.

I paste this solution on gist

In few days I'll prepare a blog post about this solving this issue.

Sep 18, 2015 21:05
Sep 18, 2015 23:33

Here is my post: It a solution for hiding all display options on ContentAreas. 

Sep 22, 2015 13:17

Thank you Grzegorz.

I haven't been able to try your solution yet but from what you describe in the comment and blog post it seems to be exactly what I was looking for.

Sep 22, 2015 15:26
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.