diff --git a/inc/Menu/AbstractMenu.php b/inc/Menu/AbstractMenu.php index 7680d2bacd3965d1fe908e063671f3cc0fc9d225..8c01abe088a1a259936927d58340e96575106293 100644 --- a/inc/Menu/AbstractMenu.php +++ b/inc/Menu/AbstractMenu.php @@ -66,9 +66,10 @@ abstract class AbstractMenu { * output, use getItems() and build the HTML yourself * * @param string|false $classprefix create a class from type with this prefix, false for no class + * @param bool $svg add the SVG link * @return string */ - public function getListItems($classprefix = '') { + public function getListItems($classprefix = '', $svg = true) { $html = ''; foreach($this->getItems() as $item) { if($classprefix !== false) { @@ -78,7 +79,7 @@ abstract class AbstractMenu { } $html .= "<li$class>"; - $html .= $item->asHtmlLink(false); + $html .= $item->asHtmlLink(false, $svg); $html .= '</li>'; } return $html; diff --git a/inc/Menu/Item/AbstractItem.php b/inc/Menu/Item/AbstractItem.php index 001dcf8ec9e5313b7aa6a9d8dba4ea879a1187c2..9af475448ab44f9b929e4345d135e996040caa28 100644 --- a/inc/Menu/Item/AbstractItem.php +++ b/inc/Menu/Item/AbstractItem.php @@ -114,13 +114,18 @@ abstract class AbstractItem { * Wraps around the label and SVG image * * @param string|false $classprefix create a class from type with this prefix, false for no class + * @param bool $svg add SVG icon to the link * @return string */ - public function asHtmlLink($classprefix = 'menuitem ') { + public function asHtmlLink($classprefix = 'menuitem ', $svg = true) { $attr = buildAttributes($this->getLinkAttributes($classprefix)); $html = "<a $attr>"; - $html .= '<span>' . hsc($this->getLabel()) . '</span>'; - $html .= inlineSVG($this->getSvg()); + if($svg) { + $html .= '<span>' . hsc($this->getLabel()) . '</span>'; + $html .= inlineSVG($this->getSvg()); + } else { + $html .= hsc($this->getLabel()); + } $html .= "</a>"; return $html; diff --git a/inc/Menu/Item/Index.php b/inc/Menu/Item/Index.php index 33908f0737fd3e7e9cd2f8b50f85ef5cd9ce0cb4..55244984c5c76336659f3716322b4c975d9844b0 100644 --- a/inc/Menu/Item/Index.php +++ b/inc/Menu/Item/Index.php @@ -4,6 +4,8 @@ namespace dokuwiki\Menu\Item; class Index extends AbstractItem { + protected $svg = DOKU_INC . 'lib/images/menu/file-tree.svg'; + /** @inheritdoc */ public function __construct() { parent::__construct(); diff --git a/inc/Menu/Item/Media.php b/inc/Menu/Item/Media.php index f5b89d908db2328e852fc550cc565e6c6f613411..e0cd04d2545c76944f7d2e6bfb88b3baff7dfa8d 100644 --- a/inc/Menu/Item/Media.php +++ b/inc/Menu/Item/Media.php @@ -4,6 +4,8 @@ namespace dokuwiki\Menu\Item; class Media extends AbstractItem { + protected $svg = DOKU_INC . 'lib/images/menu/folder-multiple-image.svg'; + /** @inheritdoc */ public function __construct() { global $ID; diff --git a/inc/Menu/Item/Recent.php b/inc/Menu/Item/Recent.php index fd38404efaf35c417e2850b6d2dadd2551f74eb9..8d924d1efa18aba040732fa404881ab1a7d296cd 100644 --- a/inc/Menu/Item/Recent.php +++ b/inc/Menu/Item/Recent.php @@ -10,6 +10,7 @@ class Recent extends AbstractItem { $this->category = 'site'; $this->accesskey = 'r'; + $this->svg = DOKU_INC . 'lib/images/menu/calendar-clock.svg'; } } diff --git a/lib/images/menu/calendar-clock.svg b/lib/images/menu/calendar-clock.svg new file mode 100644 index 0000000000000000000000000000000000000000..b19735dbb667bbfe5218915ab32d9a093aa2cf11 --- /dev/null +++ b/lib/images/menu/calendar-clock.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M15 13h1.5v2.82l2.44 1.41-.75 1.3L15 16.69V13m4-5H5v11h4.67c-.43-.91-.67-1.93-.67-3a7 7 0 0 1 7-7c1.07 0 2.09.24 3 .67V8M5 21a2 2 0 0 1-2-2V5c0-1.11.89-2 2-2h1V1h2v2h8V1h2v2h1a2 2 0 0 1 2 2v6.1c1.24 1.26 2 2.99 2 4.9a7 7 0 0 1-7 7c-1.91 0-3.64-.76-4.9-2H5m11-9.85A4.85 4.85 0 0 0 11.15 16c0 2.68 2.17 4.85 4.85 4.85A4.85 4.85 0 0 0 20.85 16c0-2.68-2.17-4.85-4.85-4.85z"/></svg> \ No newline at end of file diff --git a/lib/images/menu/file-tree.svg b/lib/images/menu/file-tree.svg new file mode 100644 index 0000000000000000000000000000000000000000..0f261882f897aa41af1fb99c19c6f5d66e2aca96 --- /dev/null +++ b/lib/images/menu/file-tree.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 3h6v4H3V3m12 7h6v4h-6v-4m0 7h6v4h-6v-4m-2-4H7v5h6v2H5V9h2v2h6v2z"/></svg> \ No newline at end of file diff --git a/lib/images/menu/folder-multiple-image.svg b/lib/images/menu/folder-multiple-image.svg new file mode 100644 index 0000000000000000000000000000000000000000..f66aaaddb2763f0fed938e181cf1a9d077783969 --- /dev/null +++ b/lib/images/menu/folder-multiple-image.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7 15l4.5-6 3.5 4.5 2.5-3L21 15m1-11h-8l-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2M2 6H0v14a2 2 0 0 0 2 2h18v-2H2V6z"/></svg> \ No newline at end of file diff --git a/lib/tpl/dokuwiki/tpl_header.php b/lib/tpl/dokuwiki/tpl_header.php index 780c413a2c4df7cc3e74a96dd09e6cb9defcaa3b..5de60df824635380d7f532906eb93a7a8a28047a 100644 --- a/lib/tpl/dokuwiki/tpl_header.php +++ b/lib/tpl/dokuwiki/tpl_header.php @@ -63,11 +63,9 @@ if (!defined('DOKU_INC')) die(); </div> <ul> <?php - tpl_toolsevent('sitetools', array( - tpl_action('recent', true, 'li', true), - tpl_action('media', true, 'li', true), - tpl_action('index', true, 'li', true) - )); + $menu = new \dokuwiki\Menu\SiteMenu(); + echo $menu->getListItems('action ', false); + unset($menu); ?> </ul> </div>