Tahir Naveed
Oct 11, 2019
  2042
(0 votes)

Set display options for content area item via code

On the subject of “note to self” & “for future reference”, when required to setup display options programmatically for a given content area item

ContentAreaItem newContentAreaItem = new ContentAreaItem() { ContentLink = “ID of your content”};

newContentAreaItem.RenderSettings = new Dictionary<string, object>();
newContentAreaItem.RenderSettings.Add("data-epi-content-display-option",”Id of display option”);

And to get all the registered displayoptions

var options = ServiceLocator.Current.GetInstance<DisplayOptions>();

Hope this might be useful for someone

Oct 11, 2019

Comments

Please login to comment.
Latest blogs
Increase timeout for long running SQL queries using SQL addon

Learn how to increase the timeout for long running SQL queries using the SQL addon.

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Overriding the help text for the Name property in Optimizely CMS

I recently received a question about how to override the Help text for the built-in Name property in Optimizely CMS, so I decided to document my...

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Resize Images on the Fly with Optimizely DXP's New CDN Feature

With the latest release, you can now resize images on demand using the Content Delivery Network (CDN). This means no more storing multiple versions...

Satata Satez | Dec 19, 2024

Simplify Optimizely CMS Configuration with JSON Schema

Optimizely CMS is a powerful and versatile platform for content management, offering extensive configuration options that allow developers to...

Hieu Nguyen | Dec 19, 2024