MenuHelper

Menu Helper utility

since

3.8.0

Methods

__construct

Private constructor

__construct() 
since

3.8.0

addPreset

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

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

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

since

3.8.0

Arguments

$name

stringThe unique identifier for the preset.

$title

stringThe display label for the preset.

$path

stringThe path to the preset file.

$replace

booleanWhether to replace the preset with the same name if any (except 'joomla').

createLevels

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

createLevels(array<mixed,\stdClass> $menuItems) : array<mixed,\stdClass>
static
since

3.8.0

Arguments

$menuItems

array<mixed,\stdClass>List of menu items loaded from database

Response

array<mixed,\stdClass>

getPresets

Get a list of available presets.

getPresets() : array<mixed,\stdClass>
static
since

3.8.0

Response

array<mixed,\stdClass>

loadPreset

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

loadPreset(string $name, boolean $fallback = true) : array<mixed,\stdClass>
static
since

3.8.0

Arguments

$name

stringThe preset name

$fallback

booleanFallback to default (joomla) preset if the specified one could not be loaded?

Response

array<mixed,\stdClass>

loadXml

Load a menu tree from an XML file

loadXml(array<mixed,\SimpleXMLElement> $elements,  &$items, array<mixed,string> $replace = array()) : void
static
since

3.8.0

Arguments

$elements

array<mixed,\SimpleXMLElement>The xml menuitem nodes

$items

$replace

array<mixed,string>The substring replacements for iterator type items

parseXmlNode

Create a menu item node from an xml element

parseXmlNode(\SimpleXMLElement $node, array<mixed,string> $replace = array()) : \stdClass
static
since

3.8.0

Arguments

$node

\SimpleXMLElementA menuitem element from preset xml

$replace

array<mixed,string>The values to substitute in the title, link and element texts

Response

\stdClass

resolveAlias

Method to resolve the menu item alias type menu item

resolveAlias( &$item) : void
static
since

3.8.0

Arguments

$item

Properties

presets

List of preset include paths

static
since

3.8.0

Type(s)

array