I have the following action.php file in one of my plugins. It generates a toolbar button which drops down to reveal three new buttons. I want to "promote" those three buttons to the top level, so that I can access them with a single click when editing a page. What changes are needed in this code?
I'd prefer to keep it in a single file if possible.
<?php
/**
* Action Component for the Wrap Plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Andreas Gohr <andi@splitbrain.org>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');
class action_plugin_bbcode extends DokuWiki_Action_Plugin {
function register(&$controller) {
$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ());
}
/**
* Inserts a toolbar button
*/
function insert_button(&$event, $param) {
$button = array(
'type' => 'picker',
'title' => $this->getLang('bbc_smallcaps'),
'icon' => '../../plugins/bbcode/images/bbc.png',
'class' => 'pk_align',
'list' => array(
array(
'type' => 'format',
'title' => $this->getLang('bbc_smallcaps'),
'icon' => '../../plugins/bbcode/images/sc.png',
'open' => '[sc]',
'close' => '[/sc]',
),
array(
'type' => 'format',
'title' => $this->getLang('bbc_smallcaps'),
'icon' => '../../plugins/bbcode/images/btn_sup.png',
'open' => '<sup>',
'close' => '</sup>',
),
array(
'type' => 'format',
'title' => $this->getLang('bbc_smallcaps'),
'icon' => '../../plugins/bbcode/images/btn_sub.png',
'open' => '<sub>',
'close' => '</sub>',
),
)
);
$button = array($button);
array_splice($event->data, 5, 0, $button);
}
}