1 Configuration Example
Aloha Settings can be configured in the node.conf using the $ALOHA_SETTINGS array. Those settings will be mapped to a corresponding JavaScript array for use with Aloha Editor. You may also define an exclusive per-node configuration by using $ALOHA_SETTINGS_NODE[node_id], where “node_id” is the id of the node you want to configure (eg. 1).
Per node configuration example:
// configure bundle path for node id 3 $ALOHA_SETTINGS_NODE[3]['bundles']['custom'] = '/customplugins';
Global configuration example:
// Table Plugin $ALOHA_SETTINGS['plugins']['table'] = array( 'config' => array('table'), 'tableConfig' => array( array('name'=>'hor-minimalist-a'), array('name'=>'box-table-a'), array('name'=>'hor-zebra') ), 'columnConfig' => array( array('name'=>'bigbold', 'iconClass'=>'GENTICS_button_col_bigbold'), array('name'=>'redwhite', 'iconClass'=>'GENTICS_button_col_redwhite') ), 'rowConfig' => array ( array('name'=>'bigbold', 'iconClass'=>'GENTICS_button_row_bigbold'), array('name'=>'redwhite', 'iconClass'=>'GENTICS_button_row_redwhite') ) ); // Image Plugin $ALOHA_SETTINGS['plugins']['image']['maxWidth'] = 1024; $ALOHA_SETTINGS['plugins']['image']['maxHeight'] = 786; $ALOHA_SETTINGS['plugins']['image']['minWidth'] = 5; $ALOHA_SETTINGS['plugins']['image']['minHeight'] = 5;
2 Configuration of Plugin Bundles
In order for the plugin to be loaded, two settings must be made in the node.conf:
- Set the path of the bundle
- Add the plugin to the list of plugins to be loaded
- Define bundle path
The bundle path for the bundle custom must be configured like this:
$ALOHA_SETTINGS['bundles']['custom'] = '/customplugins';
3 Adding custom plugins
Starting with Aloha 0.10, the mechanism for loading plugins was completely changed. It uses require.js now.
3.1 1. Placing the plugin bundle
Plugins are now organized in bundles. We place the custom bundle in the htdocs of the /Node installation and add a simple helloworld plugin:
/Node/apache/htdocs/customplugins/helloworld/lib/helloworld-plugin.js
3.2 2. Example Demo Helloworld Plugin
This is a demo plugin (which just logs ‘Hello World!’ to the JavaScript Console when loaded).
define(['aloha/plugin', 'aloha/jquery'], function(Plugin,jQuery) { "use strict"; var $ = jQuery; return Plugin.create('helloworld', { init: function() { // Executed on plugin initialization if (console && console.log) { console.log('Hello World!'); } }, destroy: function() { // Executed when this plugin is unloaded } }); });