Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Div
stylemax-width: 50%
classfloatRight
Panel
borderColor#ccc
bgColor#fff
titleSee Also
borderStylesolid
Include Page
_useful links for prefs framework
_useful links for prefs framework

 

 

In cases where you are adding a full-page editor to your site, you likely want the user's settings to be applied to every other page on your site as well. On these pages, you don't want to instantiate the preferences editor, but you do need to instantiate the page enhancer and the settings store; without these, the preferences will have no effect.

Adding the settings store and enhancer requires a two-step process:

  1. Use the Builder to build the tools, then
  2. Instantiate the tools built by the builder.

Build the Settings Store and Enhancer

Build the settings store and enhancer with a call to the Preferences Framework Builder (this call also builds a preferences editor, but you aren't required to instantiate it). The Builder can be used with either the auxiliarySchema property or with an auxiliary schema grade.

NOTE: Your auxiliary schema MUST specify a namespace. You'll need this namespace to access the components created by the builder.

Section
Column
Code Block
titleExample: Using the builder with the auxiliarySchema property
linenumberstrue
vary myAuxiliarySchema = {
    namespace: "my.prefs",
    ...
};
fluid.prefs.builder({
    primarySchema: myPrimarySchema,
    auxiliaryScham: myAuxiliarySchema
});
Column
Code Block
titleExample: Using the builder with an auxiliary schema grade
linenumberstrue
fluid.defaults("my.auxSchemaGrade", {
    gradeNames: ["fluid.prefs.auxSchema", "autoInit"],
    auxiliarySchema: {
        namespace: "my.prefs",
        ....
    }
});
fluid.prefs.builder({
    gradeNames: ["my.auxSchemaGrade"],
    primarySchema: myPrimarySchema
});

Instantiate the Enhancer

Once you've run the builder, you can access the enhancer through the namespace you specified in your auxiliary schema

 

Code Block
titleInstantiating the default separated-panel editor
linenumberstrue
var enhancer = my.prefs.uie(".prefs-editor-container");

The uie method will automatically instantiate both the settings store and the page enhancer, so you only need to make the one call.

 

 

 

 

 

The Builder takes as its input the primary and auxiliary schemas and constructs all the components necessary to render the preferences editor, store preferences, and respond to changes in preferences.

...