MenuService
in package
Menu service for standalone (Heratio) layout.
Reads the navigation menu from the menu + menu_i18n tables
and builds a nested tree using MPTT lft/rgt columns.
This provides the same menu structure that Symfony renders via QubitMenu, but using Laravel Query Builder.
Table of Contents
Methods
- clearCache() : void
- Clear the menu cache (useful after menu edits).
- getBrowseMenu() : array<string|int, mixed>
- Get the browse menu items.
- getByName() : object|null
- Get a single menu node by name.
- getChildren() : array<string|int, mixed>
- Get children of a specific menu by name.
- getEnabledPlugins() : array<string|int, string>
- Get enabled plugins list from atom_plugin table.
- getMainMenu() : array<string|int, mixed>
- Get the main (admin) menu items.
- getQuickLinks() : array<string|int, mixed>
- Get the quick links menu items.
- getTree() : array<string|int, mixed>
- Get the full menu tree for a culture.
- isPluginEnabled() : bool
- Check if a plugin is enabled.
- resolvePath() : string
- Resolve a menu path to a URL.
Methods
clearCache()
Clear the menu cache (useful after menu edits).
public
static clearCache() : void
getBrowseMenu()
Get the browse menu items.
public
static getBrowseMenu([string $culture = 'en' ]) : array<string|int, mixed>
Parameters
- $culture : string = 'en'
Return values
array<string|int, mixed>getByName()
Get a single menu node by name.
public
static getByName(string $name[, string $culture = 'en' ]) : object|null
Parameters
- $name : string
-
Menu name (e.g., 'browseMenu')
- $culture : string = 'en'
-
ISO culture code
Return values
object|null —Menu item or null
getChildren()
Get children of a specific menu by name.
public
static getChildren(string $parentName[, string $culture = 'en' ]) : array<string|int, mixed>
Parameters
- $parentName : string
-
Menu name (e.g., 'browseMenu', 'mainMenu')
- $culture : string = 'en'
-
ISO culture code
Return values
array<string|int, mixed> —Flat list of child menu items
getEnabledPlugins()
Get enabled plugins list from atom_plugin table.
public
static getEnabledPlugins() : array<string|int, string>
Used by layout partials for conditional menu rendering.
Return values
array<string|int, string> —List of enabled plugin names
getMainMenu()
Get the main (admin) menu items.
public
static getMainMenu([string $culture = 'en' ]) : array<string|int, mixed>
Parameters
- $culture : string = 'en'
Return values
array<string|int, mixed>getQuickLinks()
Get the quick links menu items.
public
static getQuickLinks([string $culture = 'en' ]) : array<string|int, mixed>
Parameters
- $culture : string = 'en'
Return values
array<string|int, mixed>getTree()
Get the full menu tree for a culture.
public
static getTree([string $culture = 'en' ]) : array<string|int, mixed>
Parameters
- $culture : string = 'en'
-
ISO culture code (e.g., 'en', 'fr')
Return values
array<string|int, mixed> —Nested array of menu items with 'children' key
isPluginEnabled()
Check if a plugin is enabled.
public
static isPluginEnabled(string $name) : bool
Parameters
- $name : string
Return values
boolresolvePath()
Resolve a menu path to a URL.
public
static resolvePath(string $path) : string
Menu paths in AtoM can be:
- Absolute URLs (http/https)
- Named routes (@routeName)
- Module/action paths (module/action)
- Relative paths
Parameters
- $path : string
-
Raw menu path from database
Return values
string —Resolved URL