dokuwiki-plugin-bootstyle/action.php

57 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2021-07-12 18:22:41 +02:00
<?php
class action_plugin_bootstyle extends DokuWiki_Action_Plugin
{
/**
* Syntax with section edit
*
* @var array
*/
private $section_edit_buttons = array(
'container',
);
/**
* Register events
*
* @param Doku_Event_Handler $controller
*/
public function register(Doku_Event_Handler $controller)
{
$controller->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, '_secedit_button');
}
/**
* Edit Form
*
* @param Doku_Event &$event
*/
public function _editform(Doku_Event $event)
{
if (!in_array($event->data['target'], $this->section_edit_buttons)) {
return;
}
$event->data['target'] = 'container';
return;
}
/**
* Set Section Edit button
*
* @param Doku_Event &$event
*/
public function _secedit_button(Doku_Event $event)
{
global $lang;
if (!in_array($event->data['target'], $this->section_edit_buttons)) {
// would suppress other edit buttons except for containers. But affects every theme.
//$event->data['name'] = '';
return;
}
$event->data['name'] = $lang['btn_secedit'] . ' - ' . ucfirst(str_replace('plugin_bootstyle_', '', $event->data['target']));
}
}