Download the PHP package teppokoivula/markup-menu without Composer
On this page you can find all versions of the php package teppokoivula/markup-menu. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download teppokoivula/markup-menu
More information about teppokoivula/markup-menu
Files in teppokoivula/markup-menu
Package markup-menu
Short Description MarkupMenu is a ProcessWire CMS/CMF module for generating menu markup.
License MPL-2.0
Homepage https://github.com/teppokoivula/MarkupMenu
Informations about the package markup-menu
MarkupMenu ProcessWire module
MarkupMenu is a ProcessWire module for generating markup for navigation menus. When provided a root page as a starting point and (optional, but recommended) the current (active) page, it generates the markup for a navigation menu as an unordered list <ul>
wrapped with a <nav>
element based on said arguments.
MarkupMenu provides a number of configurable options, including template strings used for various menu items (such as the list and nav element mentioned above), as well as hookable methods for those who need full control over how their menus are laid out.
Usage
MarkupMenu is intended for front-end use, but you can of course use it in a module as well. Typically you'll only need the render() method, which takes an array of options as its only argument:
Note: if you omit the root_page option, site root page is used by default – unless you've specified the menu_items option, in which case a root page is not necessary at all. If you omit current_page, the menu will be rendered, but current (active) page can't be highlighted etc.
Alternatively you can use MarkupMenu to render a predefined list of menu items by providing the menu_items option. Value of said option can be a PageArray or an array of arrays:
If you provide a predefined array of menu items, you can define current (active) page in the array (by default by assigning boolean true in the 'is_current' property for the active item), but if you instead provide 'current_page' and ID for each menu item like in above example, MarkupMenu can figure out active and parent pages automatically.
Options
Below you'll find all the available options and their default values. You can override these defaults with the array you pass to the render method, or you can specify an array of site-wide custom options via the site config setting $config->MarkupMenu
:
Requirements
- ProcessWire >= 3.0.112
- PHP >= 7.1.0
If you're working on an earlier version of ProcessWire or PHP, I'd highly recommend checking out MarkupSimpleNavigation module instead: https://github.com/somatonic/MarkupSimpleNavigation.
Installing
This module can be installed just like any other ProcessWire module, by downloading or cloning the MarkupMenu directory into your /site/modules/ directory. Alternatively you can install the module via Composer:
License
This project is licensed under the Mozilla Public License Version 2.0.
All versions of markup-menu with dependencies
processwire/processwire Version >=3.0.112
wireframe-framework/processwire-composer-installer Version ^1.0.0