Plugins Templates

Kepler implements a convenient mechanism to give plugins the ability to extend the platform’s basic UI structure.
Using the dynamic template pluginsTemplate and register the plugin’s templates inside the plugin.js in the section templates.

Here an example of templates for the plugin keplerjs:share

1
2
3
4
5
6
7
8
9
K.Plugin({
name: 'share',
templates: {
panelPlace: {
'panelPlace_share': {order:-5}
},
popupCursor: 'popupCursor_share'
}
});

Any plugin can be define one or many templates to include in default template placeholders panelPlace, popupCursor,popupUser.
At the property panelPlace is also specified the priority(order) of inserting the template respect to the other plugins, this value can be between -10 and +10

The templates positioned inside the template panelPlace and popupCursor

1
2
3
4
5
<template name="panelPlace">
...
{{> pluginsTemplate name='panelPlace'}}
...
</template>

Using sep parameter for define an html fragments between the blocks of rendered plugins panelSettings

1
2
3
4
5
<template name="panelSettings">
...
{{> pluginsTemplate name='panelPlace' sep='<hr />'}}
...
</template>

The global templates configuration can be modified also by settings.json file, like in this example:

1
2
3
4
5
6
7
8
9
10
11
12
{
"public": {
"templates": {
"pageHome": {
"pageHome_theme": { "show": false }
//hide only the template pageHome_theme inside the placeholder pageHome
},
"footer": { "show": false }
//hide all templates of all plugins inside the placeholder footer
}
}
}

See the private/settings.light-ui.json file for clarity.

A complete list of default extensible templates is defined in K.templates

Edit on GitHub
Licensed under Creative Commons