[drupal-devel] quicktags: for developers

Bèr Kessels berdrupal at tiscali.be
Sun Oct 2 14:28:51 UTC 2005


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_link','link','','','l', -1, 'edInsertLink'),
  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(
  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 :)


More information about the drupal-devel mailing list