1<?php
2
3require_once(__DIR__ . '/../ComboStrap/PluginUtility.php');
4
5use ComboStrap\Api\MetaManagerHandler;
6use ComboStrap\DataType;
7use ComboStrap\ExceptionCompile;
8use ComboStrap\ExecutionContext;
9use ComboStrap\Meta\Form\FormMeta;
10use ComboStrap\Meta\Form\FormMetaField;
11use ComboStrap\HttpResponseStatus;
12use ComboStrap\Identity;
13use ComboStrap\Json;
14use ComboStrap\LowQualityPageOverwrite;
15use ComboStrap\MarkupPath;
16use ComboStrap\Message;
17use ComboStrap\Meta\Api\Metadata;
18use ComboStrap\Meta\Store\MetadataDokuWikiStore;
19use ComboStrap\MetadataFormDataStore;
20use ComboStrap\MetadataFrontmatterStore;
21use ComboStrap\MetadataStoreTransfer;
22use ComboStrap\MetaManagerForm;
23use ComboStrap\MetaManagerMenuItem;
24use ComboStrap\Mime;
25use ComboStrap\PluginUtility;
26use ComboStrap\QualityDynamicMonitoringOverwrite;
27
28if (!defined('DOKU_INC')) die();
29
30/**
31 *
32 *
33 */
34class action_plugin_combo_metamanager extends DokuWiki_Action_Plugin
35{
36
37
38    public function register(Doku_Event_Handler $controller)
39    {
40
41        /**
42         * Add a icon in the page tools menu
43         * https://www.dokuwiki.org/devel:event:menu_items_assembly
44         */
45        $controller->register_hook('MENU_ITEMS_ASSEMBLY', 'AFTER', $this, 'addMenuItem');
46    }
47
48
49    public function addMenuItem(Doku_Event $event, $param)
50    {
51
52        if (!Identity::isWriter()) {
53            return;
54        }
55
56        /**
57         * The `view` property defines the menu that is currently built
58         * https://www.dokuwiki.org/devel:menus
59         * If this is not the page menu, return
60         */
61        if ($event->data['view'] != 'page') return;
62
63        global $INFO;
64        $exists = $INFO['exists'] ?? null;
65        if (!$exists) {
66            return;
67        }
68        array_splice($event->data['items'], -1, 0, array(new MetaManagerMenuItem()));
69
70    }
71
72
73}
74