November Happy Hour will be moved to Thursday December 5th.

Linus Ekström
Apr 16, 2013
  3688
(0 votes)

Sending settings from the server to your editor

I got a question how you can send settings that are defined on the server to an editor. It’s really quite simple so lets have a look on a simple example. We start by defining an editor descriptor and adding an entry in the EditorConfiguration dictionary:

[EditorDescriptorRegistration(TargetType = typeof(string), UIHint = "author")]
public class AuthorEditorDescriptor : EditorDescriptor
{
    public AuthorEditorDescriptor()
    {
        ClientEditingClass = "alloy.editors.AuthorSelector";
        EditorConfiguration["foo"] = "bar";
    }
}

The settings in the EditorConfiguration dictionary is mixed on to the editor instance when started so you can access these settings as they were regular properties of your editor. This sample checks the value of foo in the postCreate-method:

postCreate: function () {


    if (this.foo === "bar") {
        alert("Happy happy joy");
    }
},

And when the editor starts we get:

image

Apr 16, 2013

Comments

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog