eZOE - Add a button calling a custom tag

Author Message

Laurent Esposito

Wednesday 14 April 2010 10:31:28 am

Hello,

I would like to know, if it's possible, how to display a new button in the oe toolbar.

My goal is to display a specific button which call a specific custom tag in order to avoid passing through the specific custom tag screen.

I've already managed the creation of my custom tag (named mycustomtag) and display a button on the oe tool bar. However, my button doesn't call any javascript event.

Thank you for your help,

Laurent

Laurent Esposito

Wednesday 14 April 2010 10:36:44 am

In fact, I would like to imitate the button which call the "sub" or the "sup" custom tag

André R.

Friday 16 April 2010 3:58:11 am

sub and sup are native commands, and use native tags, you can't use that as your limited to what the xhtml parser in ezoe supports.

But it is possible to create custom commands that create a custom tag with a predefined name, take a look at how pagebreak is implemented, it's part of the ez theme, but could just as well have been in an TinyMCE plugin (and yes, that is how you should implement this).

The pagebreak pieces as an example (this button only inserts a tag, it does not work on/off like sub/sup does):

// Control name lookup, format: title, command
        controls : {
....
            pagebreak : ['pagebreak_desc', 'mcePageBreak'],
_mcePageBreak : function( ui, val )
        {
            var ed = this.editor, n = ed.selection.getNode();
            if ( n.nodeName === 'P' && n.parentNode.nodeName === 'BODY' )
                ed.execCommand('mceInsertRawHTML', false, '</p><div type="custom" class="pagebreak mceItemCustomTag"><p>pagebreak</p></div><p>');
            else if ( n.nodeName === 'BODY' )
                ed.execCommand ('mceInsertRawHTML', false, '<div type="custom" class="pagebreak mceItemCustomTag"><p>pagebreak</p></div>');
            else
                alert( 'Not a suported location for a pagebreak, place it in the root of your document!' );
        },

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Laurent Esposito

Friday 23 April 2010 3:17:23 am

Thank you very much. I will try it !

Best regards,

Laurent

Sebastiaan van der Vliet

Thursday 19 May 2011 2:21:41 am

Hi Community,

Has anybody had any success in turning a custom tag into a button? I would like to see an example...

Thanks,

Sebastiaan

Certified eZ publish developer with over 9 years of eZ publish experience. Available for challenging eZ publish projects as a technical consultant, project manager, trouble shooter or strategic advisor.

Sebastiaan van der Vliet

Thursday 19 May 2011 6:37:00 am

Well, that was actually easy. I will do a blogpost about it when i have some time.

Certified eZ publish developer with over 9 years of eZ publish experience. Available for challenging eZ publish projects as a technical consultant, project manager, trouble shooter or strategic advisor.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 01:57:01
Script start
Timing: Jan 18 2025 01:57:01
Module start 'layout'
Timing: Jan 18 2025 01:57:01
Module start 'content'
Timing: Jan 18 2025 01:57:02
Module end 'content'
Timing: Jan 18 2025 01:57:02
Script end

Main resources:

Total runtime0.6423 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 589.1484152.6406
Module start 'layout' 0.00480.0037 741.789139.4766
Module start 'content' 0.00850.6320 781.2656616.6016
Module end 'content' 0.64050.0018 1,397.867216.1250
Script end 0.6423  1,413.9922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.5440160.0002
Check MTime0.00140.2183160.0001
Mysql Total
Database connection0.00060.094310.0006
Mysqli_queries0.555386.4490680.0082
Looping result0.00160.2485660.0000
Template Total0.602893.820.3014
Template load0.00220.349020.0011
Template processing0.600593.484320.3002
Template load and register function0.00050.082710.0005
states
state_id_array0.00160.248710.0016
state_identifier_array0.00130.209420.0007
Override
Cache load0.00190.3002310.0001
Sytem overhead
Fetch class attribute can translate value0.00240.375430.0008
Fetch class attribute name0.00260.397980.0003
XML
Image XML parsing0.01231.911430.0041
class_abstraction
Instantiating content class attribute0.00000.004290.0000
General
dbfile0.01542.3947240.0006
String conversion0.00000.001440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs