3 namespace dokuwiki\Menu\Item
;
8 * Most complex item. Shows the edit button but mutates to show, draft and create based on
11 class Edit
extends AbstractItem
14 public function __construct()
20 parent
::__construct();
22 if ($ACT === 'show') {
23 $this->method
= 'post';
24 if ($INFO['writable']) {
25 $this->accesskey
= 'e';
26 if (!empty($INFO['draft'])) {
27 $this->type
= 'draft';
28 $this->params
['do'] = 'draft';
30 $this->params
['rev'] = $REV;
31 if (!$INFO['exists']) {
32 $this->type
= 'create';
36 if (!actionOK("source")) throw new \
RuntimeException("action disabled: source");
37 $params['rev'] = $REV;
38 $this->type
= 'source';
39 $this->accesskey
= 'v';
42 if (auth_quickaclcheck($INFO['id']) < AUTH_READ
) throw new \
RuntimeException("no permission to read");
43 $this->params
= ['do' => ''];
45 $this->accesskey
= 'v';
52 * change the icon according to what type the edit button has
54 protected function setIcon()
57 'edit' => '01-edit_pencil.svg',
58 'create' => '02-create_pencil.svg',
59 'draft' => '03-draft_android-studio.svg',
60 'show' => '04-show_file-document.svg',
61 'source' => '05-source_file-xml.svg'
63 if (isset($icons[$this->type
])) {
64 $this->svg
= DOKU_INC
. 'lib/images/menu/' . $icons[$this->type
];