class MenuHelper

Menu Helper utility

Methods

static  void
addPreset( string $name, string $title, string $path, bool $replace = true)

Add a custom preset externally via plugin or any other means.

static  stdClass[]
getPresets()

Get a list of available presets.

static  stdClass[]
loadPreset( string $name, bool $fallback = true)

Load the menu items from a preset file into a hierarchical list of objects

static  void
resolveAlias( stdClass $item)

Method to resolve the menu item alias type menu item

static  stdClass[]
createLevels( stdClass[] $menuItems)

Parse the flat list of menu items and prepare the hierarchy of them using parent-child relationship.

Details

static void addPreset( string $name, string $title, string $path, bool $replace = true)

Add a custom preset externally via plugin or any other means.

WARNING: Presets with same name will replace previously added preset except Joomla's default preset (joomla)

Parameters

string $name The unique identifier for the preset.
string $title The display label for the preset.
string $path The path to the preset file.
bool $replace Whether to replace the preset with the same name if any (except 'joomla').

Return Value

void

static stdClass[] getPresets()

Get a list of available presets.

Return Value

stdClass[]

static stdClass[] loadPreset( string $name, bool $fallback = true)

Load the menu items from a preset file into a hierarchical list of objects

Parameters

string $name The preset name
bool $fallback Fallback to default (joomla) preset if the specified one could not be loaded?

Return Value

stdClass[]

static void resolveAlias( stdClass $item)

Method to resolve the menu item alias type menu item

Parameters

stdClass $item &$item The alias object

Return Value

void

static stdClass[] createLevels( stdClass[] $menuItems)

Parse the flat list of menu items and prepare the hierarchy of them using parent-child relationship.

Parameters

stdClass[] $menuItems List of menu items loaded from database

Return Value

stdClass[]