forked from user9209/dokuwiki_plugin_codebutton
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.php
More file actions
45 lines (38 loc) · 1.32 KB
/
action.php
File metadata and controls
45 lines (38 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\EventHandler;
use dokuwiki\Extension\Event;
/**
* Action Plugin: Inserts a button into the toolbar to add file tags
*
* @author Simon Jacob, Gina Haeussge
*/
class action_plugin_codebuttonmodbash extends ActionPlugin {
/**
* Register the event handlers
*
* @param EventHandler $controller DokuWiki's event controller object
*/
public function register(EventHandler $controller) {
$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', []);
}
/**
* Inserts the toolbar button
*
* @param Event $event event object
* @param mixed $param [the parameters passed as fifth argument to
* register_hook() when this handler was registered,
* here just an empty array..]
*/
public function insert_button(Event $event, $param) {
$codeStr = $this->getConf('codeStr');
$insert = $this->getLang('insert');
$event->data[] = [
'type' => 'format',
'title' => $insert.': <code '.$codeStr.'>...</code>',
'icon' => '../../plugins/codebuttonmodbash/codebash.png',
'open' => '<code '.$codeStr.'>\n',
'close' => '\n</code>',
];
}
}