Back to Joomla project (class list)

Class AbstractMenu - list of methods

Menu class

Direct known subclasses

Package: Joomla\CMS\Menu
Copyright: (C) 2006 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Menu/AbstractMenu.php
Project: Joomla

Method Summary

public
(mixed $options = array())

Class constructor
Parameters
  • array $options An array of configuration options.
Since
  • 1.5
Show source code of this method: __construct Source Code

public static \Joomla\CMS\Menu\AbstractMenu
(mixed $client, mixed $options = array())

Returns a Menu object
Parameters
  • string $client The name of the client
  • array $options An associative array of options
Returns
  • \Joomla\CMS\Menu\AbstractMenu A menu object.
Since
  • 1.5
Deprecated
  • 5.0
-
  • \Exception
Show source code of this method: getInstance Source Code

public void
(mixed $user)

Setter for the current user used to build menu.
Parameters
  • \Joomla\CMS\User\User $user The new user to set.
Returns
  • void
Since
  • 3.9.26
Show source code of this method: setUser Source Code

public \Joomla\CMS\Menu\MenuItem|null
(mixed $id)

Get menu item by id
Parameters
  • int $id The item id
Returns
  • \Joomla\CMS\Menu\MenuItem|null The item object if the ID exists or null if not found
Since
  • 1.5
Show source code of this method: getItem Source Code

public bool
(mixed $id, mixed $language = '*')

Set the default item by id and language code.
Parameters
  • int $id The menu item id.
  • string $language The language code (since 1.6).
Returns
  • bool True if a menu item with the given ID exists
Since
  • 1.5
Show source code of this method: setDefault Source Code

public \Joomla\CMS\Menu\MenuItem|void
(mixed $language = '*')

Get the default item by language code.
Parameters
  • string $language The language code, default value of * means all.
Returns
  • \Joomla\CMS\Menu\MenuItem|void The item object or null when not found for given language
Since
  • 1.5
Show source code of this method: getDefault Source Code

public \Joomla\CMS\Menu\MenuItem|void
(mixed $id)

Set the default item by id
Parameters
  • int $id The item id
Returns
  • \Joomla\CMS\Menu\MenuItem|void The menu item representing the given ID if present or null otherwise
Since
  • 1.5
Show source code of this method: setActive Source Code

public \Joomla\CMS\Menu\MenuItem|void
()

Get menu item by id.
Returns
  • \Joomla\CMS\Menu\MenuItem|void The item object if an active menu item has been set or null
Since
  • 1.5
Show source code of this method: getActive Source Code

public \Joomla\CMS\Menu\MenuItem|\Joomla\CMS\Menu\MenuItem[]
(mixed $attributes, mixed $values, mixed $firstonly = false)

Gets menu items by attribute
Parameters
  • mixed $attributes The field name(s).
  • mixed $values The value(s) of the field. If an array, need to match field names each attribute may have multiple values to lookup for.
  • bool $firstonly If true, only returns the first item found
Returns
  • \Joomla\CMS\Menu\MenuItem|\Joomla\CMS\Menu\MenuItem[] An array of menu item objects or a single object if the $firstonly parameter is true
Since
  • 1.5
Show source code of this method: getItems Source Code

public \Joomla\Registry\Registry
(mixed $id)

Gets the parameter object for a certain menu item
Parameters
  • int $id The item id
Returns
  • \Joomla\Registry\Registry
Since
  • 1.5
Show source code of this method: getParams Source Code

public \Joomla\CMS\Menu\MenuItem[]
()

Getter for the menu array
Returns
  • \Joomla\CMS\Menu\MenuItem[]
Since
  • 1.5
Show source code of this method: getMenu Source Code

public bool
(mixed $id)

Method to check Menu object authorization against an access control object and optionally an access extension object
Parameters
  • int $id The menu id
Returns
  • bool
Since
  • 1.5
Show source code of this method: authorise Source Code

public array
()

Loads the menu items
Returns
  • array
Since
  • 1.5
Show source code of this method: load Source Code

protected \Joomla\CMS\User\User
()

Internal getter for the user. Returns the injected one if any, or the current one if none.
Returns
  • \Joomla\CMS\User\User
Since
  • 3.9.26
Show source code of this method: getUser Source Code

public \Joomla\CMS\User\User|null
(mixed $propName)

Magic getter for the user object. Returns the injected one if any, or the current one if none.
Parameters
  • string $propName Name of the missing or protected property.
Returns
  • \Joomla\CMS\User\User|null
Since
  • 3.9.26
Show source code of this method: __get Source Code

Properties Summary

protected \Joomla\CMS\Menu\MenuItem[]
$items
Array to hold the menu items
Since
  • 4.0.0
protected int[]
$default
Identifier of the default menu item. Key of the array is the language.
Since
  • 4.0.0
protected int
$active
Identifier of the active menu item
Since
  • 4.0.0
protected static \Joomla\CMS\Menu\AbstractMenu[]
$instances
Menu instances container.
Since
  • 1.7
protected \Joomla\CMS\User\User
$storedUser
User object to check access levels for
Since
  • 3.9.26
private bool
$itemsLoaded
Flag for checking if the menu items have been loaded
Since
  • 4.0.0

Tags Summary

Since
1.5