Navigation Builder
Creating Menus
Pragma CMS allows you to create dynamic menus (e.g., main-menu, footer-menu) that can be centrally managed in the Administration panel.
The Navigation Builder natively supports various link types to keep your routing structurally sound and dynamically translated:
- Collection Entry: Dynamically link to an Article, a Page, or a Product. If the entry's slug changes, the menu link updates automatically.
- System Page (Route): Link securely to hardcoded routes (e.g.,
front.blog.index). - Custom URL: Link to external websites.
- Section / Divider: Create non-clickable headers or visual separators for dropdowns.
- Mailto / Tel: Quickly generate contact links.
Menus also support advanced attributes like target="_blank", custom css_classes, anchor targets (#mission), and attaching specific icons or media directly to a menu item.
Rendering Menus
Once your menu is created and populated in the backend, rendering it on the frontend requires a single function call using the menu's unique handle.
In Twig:
{{ render_menu('main-menu') }}
In PHP:
<?= render_menu('main-menu'); ?>
The render_menu() function automatically traverses the hierarchy (parent/child items), applies the active language routes, and outputs clean, semantic HTML (<ul>, <li>, <a>).