To create your own module, you must understand how to modify the layout, if this is not the case, go to the Layout section of the documentation.

Once you have mastered the modification of the layout, start by creating a layout that suits you, in this example, we will take the simplest configuration possible :

var options = {
	layout : [
    {
		    id: 'main',
		    target: 'left',
		    category: 'menu',
		    items:[
			    {
				    name: 'Custom module',
				    icon: 'bars',
			    },
		    ]
        }
    ]
}

var instance = new AsukaDesigner('#myId');

Our new menu is already functional, but it is currently opening an empty window, in order to add content to it, the module configuration must be modified by adding the necessary properties :

{
    name: 'Custom module',
    icon: 'bars',
    fallback: 'modal',
    callback: function(el){
        el.innerHTML('My custom module content')
    }
},

The fallback is how the opening of the menu will be handled. You have the choice between different types of fallback: modal, drawer, inline, popover, function.

If you choose the fallback function, no window will be opened and the callback will be used ideally in the case of a function to be executed.

In other cases, the callback will take the container of the open window as a parameter.

Custom module container

You might want to display a module in a particular html element. For that, it will be necessary to define a special block which will have for id “custom” and for target “custom”.

We can then define the different modules that compose them by assigning them a container property “container” which will have the selector of your choice as a value :

var options = {
	layout : [
    {
		    id: 'custom',
		    target: 'custom',
		    items:[
			    {
				    name: 'Views',
					container: '#id'
			    },
			    {
				    name: 'Layers',
					container: '.class'
			    }
		    ]
        }
    ]
}

var instance = new AsukaDesigner('#myId');
Was this article helpful to you? Yes No

How can we help?