Update section edit buttons

This commit is contained in:
2026-03-17 10:51:30 +01:00
parent b81e5cf6e4
commit e1e89b40fb
3 changed files with 113 additions and 5 deletions

View File

@@ -10,6 +10,37 @@
if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */
// Replace default section edit buttons with a compact pencil icon
global $EVENT_HANDLER;
$EVENT_HANDLER->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', null, '_luxtools_secedit_button');
function _luxtools_secedit_button(\dokuwiki\Extension\Event $event, $param) {
global $ID, $INFO;
$data = $event->data;
if (!isset($data['name']) || $data['name'] === '') {
$event->preventDefault();
$event->result = '';
return;
}
$name = $data['name'];
$secid = $data['secid'];
unset($data['name'], $data['secid']);
$params = array_merge(
['do' => 'edit', 'rev' => $INFO['lastmod'], 'summary' => '[' . $name . '] '],
$data
);
$html = '<div class="secedit editbutton_' . hsc($data['target']) . ' editbutton_' . (int)$secid . '">';
$html .= html_btn('secedit', $ID, '', $params, 'post', $name);
$html .= '</div>';
$event->preventDefault();
$event->result = $html;
}
$hasSidebar = page_findnearest($conf['sidebar']);
$showSidebar = $hasSidebar && ($ACT == 'show');
?><!DOCTYPE html>