Try our conversational search powered by Generative AI!

Linus Ekström
Apr 16, 2013
  3534
(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
Product Listing Page - using Graph

Optimizely Graph makes it possible to query your data in an advanced way, by using GraphQL. Querying data, using facets and search phrases, is very...

Jonas Bergqvist | Jul 5, 2024

Optimizely Search and Navigation - Part 2 - Filter Tips

Introduction Continuing from Part 1 – Search Tips , today I will share the next part – filter tips. The platform versions used for this article are...

Binh Nguyen Thi | Jul 1, 2024

Integrating HubSpot CRM without the MA Connector

Have HubSpot CRM? Want to push user data into it from Optimizely? Don’t have any personalisation requirements with that data? Don’t want to pay $80...

Matt Pallatt | Jun 27, 2024

Keeping the website secure by updating external packages

Did you see the latest warning from Optimizely to update this package with a critical security warning? https://world.optimizely.com/documentation/...

Daniel Ovaska | Jun 27, 2024