DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:menus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
devel:menus [2019-01-06 14:55] Aleksandrdevel:menus [2019-05-06 22:23] (current) daumling
Line 53: Line 53:
  
 Please refer to the [[gh>inc/Menu/AbstractMenu.php|source]] for what else is available. Please refer to the [[gh>inc/Menu/AbstractMenu.php|source]] for what else is available.
 +
 +If you need specific HTML for menu items, you need to loop over the menu items and create the HTML
 +yourself. For example, this loop would create the icons in the [[:template:writr|writr template]], which is a bit more complex:
 +
 +<code php>
 +$items = (new \dokuwiki\Menu\PageMenu())->getItems();
 +foreach($items as $item) {
 +  echo '<li>'
 +      .'<a href="'.$item->getLink().'" title="'.$item->getTitle().'">'
 +      .'<span class="icon">'.inlineSVG($item->getSvg()).'</span>'
 +      . '<span class="a11y">'.$item->getLabel().'</span>'
 +      . '</a></li>';
 +}
 +</code>
  
 ===== Legacy Support ===== ===== Legacy Support =====
devel/menus.txt · Last modified: 2019-05-06 22:23 by daumling

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki