Adding a custom button to the EZPublish online editor

A short explanation on how to add a custom button to the  EZPublish online editor (ezoe).

Step 1: Setting up the extension

The custom button could be set up using an existing ezpublish extension or by creating a new one. Assuming you want to use a new extension, create a new folder called ‘newbutton‘ in the extension folder. Don’t forget to activate the extension by adding ‘ActiveExtensions[]=newbutton’ or ‘ActiveAccessExtensions[]=newbutton’ to your list of ExtensionSettings in site.ini.append.php:


Step 2: Settings

Create a subfolder called ‘settings’ in the extension/newbutton folder. In the settings folder, create a file ‘content.ini.append.php’ and add the settings below. The ‘IsInline’ and ‘CustomAttributes’ settings are optional.

<?php /* #?ini charset="utf-8"?





Then create the file ‘ezoe.ini.append.php’ and add the following code:

<?php /* #?ini charset="utf-8"?




The Buttons[style] setting defines where your new button will appear in the toolbar of the online editor. Check the ezoe.ini file in the online editor extension for other options. Now create the file ‘design.ini.append.php’ and add the following code:

<?php /* #?ini charset="utf-8"?




Step 3: Javascript and CSS
Now that the settings folder has been set up, create a subfolder ‘design’ in the extension/newbutton folder. Then create a folder ‘admin2’ within the subfolder ‘extension/newbutton/design’. Within the folder ‘extension/newbutton/design/admin2’ create the subfolders ‘stylesheets’ and ‘javascript’. Within the ‘stylesheets’ folder, create a CSS file called ‘newbutton_ezoe.css’. Add the following code to this CSS file:
.o2k7Skin span.mce_newbutton {background-position:-140px 0}

The background position determines what the icon will look like. It’s using the image ‘extension/ezoe/design/standard/javascript/themes/ez/img/icons.png’. If you want to create a new image for your button, you will have to add it to icons.png and then specify the proper offset in your CSS file.

Create a subfolder ‘plugins’ in the folder ‘extension/newbutton/design/admin2/javascript’, and within the ‘plugins’ folder a subfolder called ‘newbutton’. Within the ‘extension/newbutton/design/admin2/javascript/plugins/newbutton’ folder, create two files: editor_plugin_src.js and editor_plugin.js. In the editor_plugin_src.js file, add the following code:

(function(tinymce) {
        tinymce.create('tinymce.plugins.NewbuttonPlugin', {
                init : function(ed, url) {
                        //var n = ed.dom.getNode();

               // Register commands
                        ed.addCommand('mceNewbutton', function() {
                ed.execCommand('mceCustom', false, 'newbutton');

            // Register buttons
                        ed.addButton('newbutton', {title : 'newbutton', cmd : 'mceNewbutton'});

            ed.onNodeChange.add(function(ed, cm, n) {
                cm.setActive('newbutton', n.nodeName === 'SPAN');


                getInfo : function() {
                        return {
                                longname : 'NewButton',
                                author : 'Fumaggo',
                                authorurl : '',
                                infourl : '',
                                version : tinymce.majorVersion + "." + tinymce.minorVersion

        // Register plugin
        tinymce.PluginManager.add('newbutton', tinymce.plugins.NewbuttonPlugin);

Check out the other plugins at ‘ezoe/design/standard/javascript/plugins’ to see what is possible. When you are done, compress the Javascript code at

and put the resulting code in  the file: editor_plugin.js in the same directory. You should now have an additional ‘underline’ button on your toolbar, next to the existing ‘underline’ button. However, clicking on the ‘underline’ button on the right side will open a popup window for custom tags with the ‘newbutton’ custom tag already preselected in the drop-down list.

For more information, also check:

Leave a Reply

Your email address will not be published. Required fields are marked *