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
Next revision
Previous revision
devel:menus [2019-01-06 13:59] – [Available Menus] Link to Wikipedia Michaelsydevel:menus [2019-05-06 22:23] (current) daumling
Line 1: Line 1:
 ====== Menus ====== ====== Menus ======
  
-Menus are an important part of a template. They provide access to the wiki's functionality aka. actions. Eg, they may provide a button or link to edit the current page, access recent changes or offer to export a PDF.+Menus are an important part of a template. They provide access to the wiki's functionality aka. actions. E.g., they may provide a button or link to edit the current page, access recent changes or offer to export a PDF.
  
-DokuWiki groups these actions into different menus which can be inserted into a template at different positions.+[[:DokuWiki]] groups these actions into different menus which can be inserted into a template at different positions.
  
 There is also an [[https://www.patreon.com/posts/menus-14160215|introductory blog post]] available. There is also an [[https://www.patreon.com/posts/menus-14160215|introductory blog post]] available.
 +
 ===== Available Menus ===== ===== Available Menus =====
  
 ^ view    ^ Source ^ Description ^ ^ view    ^ Source ^ Description ^
-| ''site'' | [[gh>inc/Menu/SiteMenu.php|SiteMenu]] | defines all wiki wide actions, eg. actions not related to one page. Examples: Recent Changes, Sitemap) |+| ''site'' | [[gh>inc/Menu/SiteMenu.php|SiteMenu]] | defines all wiki wide actions, e.g. actions not related to one page. Examples: Recent Changes, Sitemap) |
 | ''user'' | [[gh>inc/Menu/UserMenu.php|UserMenu]] | defines the actions related to the current user. Examples: Login, Admin | | ''user'' | [[gh>inc/Menu/UserMenu.php|UserMenu]] | defines the actions related to the current user. Examples: Login, Admin |
 | ''page'' | [[gh>inc/Menu/PageMenu.php|PageMenu]] | defines the action related to the current page. Examples: Edit, Show old Revisions | | ''page'' | [[gh>inc/Menu/PageMenu.php|PageMenu]] | defines the action related to the current page. Examples: Edit, Show old Revisions |
Line 16: Line 17:
  
 Plugins can extend and modify the above menus using the [[devel:event:MENU_ITEMS_ASSEMBLY]] event. Plugins can extend and modify the above menus using the [[devel:event:MENU_ITEMS_ASSEMBLY]] event.
- 
  
 ===== Menu Items ===== ===== Menu Items =====
Line 35: Line 35:
  
 To match the style of other icons, it is recommended to either pick an icon from the huge, free selection at https://materialdesignicons.com/ or adhere to the [[https://material.io/guidelines/style/icons.html|Material Design Guidelines]] when designing your own icon. To match the style of other icons, it is recommended to either pick an icon from the huge, free selection at https://materialdesignicons.com/ or adhere to the [[https://material.io/guidelines/style/icons.html|Material Design Guidelines]] when designing your own icon.
 +
 ===== Adding Menus to Templates ===== ===== Adding Menus to Templates =====
  
Line 52: 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 =====
Line 62: Line 77:
   * ''tpl_actiondropdown()''   * ''tpl_actiondropdown()''
   * ''tpl_toolsevent()''   * ''tpl_toolsevent()''
 +
 +
devel/menus.1546779558.txt.gz · Last modified: 2019-01-06 13:59 by Michaelsy

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