xref: /plugin/mdimport/action.php (revision 7cb424c90c7e1aca7edae5f79baaec2e55306143)
1<?php
2
3use dokuwiki\Extension\ActionPlugin;
4use dokuwiki\Extension\EventHandler;
5use dokuwiki\Extension\Event;
6
7class action_plugin_mdimport extends ActionPlugin
8{
9    /** @inheritDoc */
10    public function register(EventHandler $controller)
11    {
12        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handleToolbar');
13    }
14
15    public function handleToolbar(Event $event, $param)
16    {
17        // Log pour vérifier l'appel
18        file_put_contents('/tmp/mdimport.log', "handleToolbar called at " . date('Y-m-d H:i:s') . "\n", FILE_APPEND);
19
20        $event->data[] = array(
21            'type'   => 'mdimport',
22            'title'  => 'Import Markdown file',
23            'icon'   => DOKU_BASE . 'lib/plugins/mdimport/md-icon.png',
24            'open'   => '',
25            'close'  => '',
26            'sample' => 'Import...',
27        );
28    }
29}
30