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; 17use ComboStrap\Site; 18 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 public function register(Doku_Event_Handler $controller) 29 { 30 31 /** 32 * Add a icon in the page tools menu 33 * https://www.dokuwiki.org/devel:event:menu_items_assembly 34 */ 35 $controller->register_hook('MENU_ITEMS_ASSEMBLY', 'AFTER', $this, 'handle_breadcrumb_history'); 36 37 38 } 39 40 41 public function handle_breadcrumb_history(Doku_Event $event, $param) 42 { 43 44 45 //check if enabled 46 if (Site::getVisitedPagesCountInHistoricalBreadCrumb() <= 0) return; 47 48 if (Bootstrap::getBootStrapMajorVersion() == Bootstrap::BootStrapFiveMajorVersion) { 49 50 51 /** 52 * The `view` property defines the menu that is currently built 53 * https://www.dokuwiki.org/devel:menus 54 * If this is not the site menu, return 55 */ 56 if ($event->data['view'] != 'site') return; 57 58 59 array_splice($event->data['items'], -1, 0, array(new HistoricalBreadcrumbMenuItem())); 60 61 } 62 63 } 64 65 66} 67 68 69 70