[drupal-devel] quicktags: for developers
Hello, I just tagged quicktags for 4.6 after polishing it a bit. However, the reason for this mail is that it has a hook for other modules. example: http://www.chiquechick.com/comment/reply/184#comment In the source you find an example plus some documentation: /* array(id, display, tagStart, tagEnd, access, open, location) * id; // used to name the toolbar button * display; // label on button * tagStart; // open tag * tagEnd; // close tag * access; // access key * open; // set to -1 if tag does not need to be closed * location; // optional: onclick action omit the (). */ function quicktags_quicktags() { $items = array( array('ed_italic','italic','<em>','</em>','i'), array('ed_bold','bold','<strong>','</strong>','b'), array('ed_block','b-quote','<blockquote>','</blockquote>','q'), array('ed_link','link','','','l', -1, 'edInsertLink'), array('ed_break','break','<!--break-->','','t',-1)); return $items; } so, if you want you module foobar to add 'Foo' and 'Bar' around the selected text, you need to do: function foobar_quicktags() { $items = array( array('ed_foo','FooBar','Foo','Bar','f')); return $items; } you can call other JS too: function foobar_quicktags() { $items = array( array('ed_foo','FooBar','','','f', -1, 'fooBar')); return $items; } which will transform into "javascript:fooBar(edCanvas[X], Y)" where edCanvas[X] is the calling textarea and I a unique button number. There is one sidenote: I call the icons by name. We need to find a solution to be able to iether ignore icons if they are not found, or to call them from the other modules directory. Hope to hear from your hooks soon :) Bèr
participants (1)
-
Bèr Kessels