1<?php 2 3/** 4 * Copyright (c) 2021. ComboStrap, Inc. and its affiliates. All Rights Reserved. 5 * 6 * This source code is licensed under the GPL license found in the 7 * COPYING file in the root directory of this source tree. 8 * 9 * @license GPL 3 (https://www.gnu.org/licenses/gpl-3.0.en.html) 10 * @author ComboStrap <support@combostrap.com> 11 * 12 */ 13 14use ComboStrap\Bootstrap; 15use ComboStrap\PluginUtility; 16use ComboStrap\HistoricalBreadcrumbMenuItem; 17 18require_once(__DIR__ . '/../class/PluginUtility.php'); 19 20/** 21 * 22 * https://en.wikipedia.org/wiki/Breadcrumb_navigation#Websites 23 */ 24class action_plugin_combo_historicalbreadcrumb extends DokuWiki_Action_Plugin 25{ 26 27 28 const HISTORICAL_BREADCRUMB_NAME = "historical-breadcrumb"; 29 30 public function register(Doku_Event_Handler $controller) 31 { 32 33 /** 34 * Add a icon in the page tools menu 35 * https://www.dokuwiki.org/devel:event:menu_items_assembly 36 */ 37 $controller->register_hook('MENU_ITEMS_ASSEMBLY', 'AFTER', $this, 'handle_breadcrumb_history'); 38 39 40 } 41 42 43 public function handle_breadcrumb_history(Doku_Event $event, $param) 44 { 45 46 global $conf; 47 48 //check if enabled 49 if (!$conf['breadcrumbs']) return; 50 51 if(Bootstrap::getBootStrapMajorVersion()== Bootstrap::BootStrapFiveMajorVersion) { 52 53 54 /** 55 * The `view` property defines the menu that is currently built 56 * https://www.dokuwiki.org/devel:menus 57 * If this is not the site menu, return 58 */ 59 if ($event->data['view'] != 'site') return; 60 61 /** 62 * Making popover active 63 */ 64 PluginUtility::getSnippetManager()->attachJavascriptSnippetForRequest("popover"); 65 66 /** 67 * Css 68 */ 69 PluginUtility::getSnippetManager()->attachCssSnippetForRequest(self::HISTORICAL_BREADCRUMB_NAME); 70 71 array_splice($event->data['items'], -1, 0, array(new HistoricalBreadcrumbMenuItem())); 72 73 } 74 75 } 76 77 78 79 80} 81 82 83 84