Configuration of Aloha Settings

This page describes bundle configuration and how to setup custom plugins

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[key], where “key” is either the local id or the global id or the name of the node you want to configure (eg. 1, “3D6C.bbcc391e-ae22-11e9-9f0d-00155df0382f” or “Gentics CMS Demo”).

Configuration per local ID, global ID and name cannot be mixed. The CMS will first look for a configuration by global ID, if that is not found, by node name and if that is not found by local ID.

Per node configuration example:

node.conf

// configure bundle path for node with global ID 3D6C.bbcc391e-ae22-11e9-9f0d-00155df0382f
$ALOHA_SETTINGS_NODE['3D6C.bbcc391e-ae22-11e9-9f0d-00155df0382f']['bundles']['custom'] = '/customplugins'; 

Global configuration example:

node.conf

// 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 Configure Aloha Editor in a template

See Configure Aloha Editor in a template

4 Adding custom plugins

Starting with Aloha 0.10, the mechanism for loading plugins was completely changed. It uses require.js now.

4.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/var/httpd/htdocs/customplugins/helloworld/lib/helloworld-plugin.js

4.2 2. Example Demo Helloworld Plugin

This is a demo plugin (which just logs ‘Hello World!’ to the JavaScript Console when loaded).

helloworld-plugin.js

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 
      } 
   }); 
});

5 Changing the toolbar settings

The toolbar settings contain all components of common and extra plugins, but if custom plugins are added that need to adopt components into the toolbar, the toolbar settings need to be extended.

The default configuration in the GCMS is


$ALOHA_SETTINGS['toolbar'] = array(
    'tabs'            => array(
        array('label' => 'tab.format.label'),
        array('label' => 'tab.insert.label', 'components' => array(array("gcnArena"))),
        array('label' => 'tab.link.label', 'components' => array("editLink", "removeLink", "linkBrowser", "gcnLinkBrowser", "gcnFileUpload"))
    )
);

This can e.g. be extended to add buttons increase and decrease (for the community fontsize plugin) like that:

/Node/etc/conf.d/*.conf

$ALOHA_SETTINGS['toolbar'] = array(
    'tabs'            => array(
        array('label' => 'tab.format.label', 'components' => array(array('increase', 'decrease'))),
        array('label' => 'tab.insert.label', 'components' => array(array("gcnArena"))),
        array('label' => 'tab.link.label', 'components' => array("editLink", "removeLink", "linkBrowser", "gcnLinkBrowser", "gcnFileUpload"))
    )
);

Note that `$ALOHA_JQUERYUI_SETTINGS` can also be used. However `$ALOHA_JQUERYUI_SETTINGS` will always be global (for the whole CMS). `$ALOHA_SETTINGS` is its equivalent and `$ALOHA_SETTINGS_NODE[‘’]` can be used to specifiy settings for a specific Node.