Update section edit buttons
This commit is contained in:
31
main.php
31
main.php
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user