Menu class
- Depuis
- 1.5
- Note
- Will become abstract in Joomla 4
◆ __construct()
__construct |
( |
|
$options = array() | ) |
|
Class constructor
- Paramètres
-
array | $options | An array of configuration options. |
- Depuis
- 1.5
It is preferred NOT to inject and store the user when constructing the menu object, at least for the Menu object used by Joomla. The menu object can be built very early in the request, from an onAfterInitialise event but the user can be updated later (by the Remember me plugin for instance). As the stored user object is not updated, the menu will render incorrectly, not complying with menu items access levels. See https://github.com/joomla/joomla-cms/issues/11541
Références $item, $options, et null.
◆ __get()
Magic getter for the user object. Returns the injected one if any, or the current one if none.
Using a magic getter to preserve B/C when we stopped storing the user object upon construction of the menu object. As the user property is not initialized anymore, this getter ensures any class extending this one can still use $instance->user and get a proper value.
- Paramètres
-
string | $propName | Name of the missing or protected property. |
- Renvoie
- User|null
- Depuis
- 3.9.26
Références Factory\getUser().
◆ authorise()
Method to check Menu object authorization against an access control object and optionally an access extension object
- Paramètres
-
- Renvoie
- boolean
- Depuis
- 1.5
Références $id, et $menu.
◆ getActive()
Get menu item by id.
- Renvoie
- MenuItem|null The item object if an active menu item has been set or null
- Depuis
- 1.5
◆ getDefault()
getDefault |
( |
|
$language = '*' | ) |
|
Get the default item by language code.
- Paramètres
-
string | $language | The language code, default value of * means all. |
- Renvoie
- MenuItem|null The item object or null when not found for given language
- Depuis
- 1.5
Références $language.
◆ getInstance()
static getInstance |
( |
|
$client, |
|
|
|
$options = array() |
|
) |
| |
|
static |
◆ getItem()
Get menu item by id
- Paramètres
-
- Renvoie
- MenuItem|null The item object if the ID exists or null if not found
- Depuis
- 1.5
Références $id, et null.
◆ getItems()
getItems |
( |
|
$attributes, |
|
|
|
$values, |
|
|
|
$firstonly = false |
|
) |
| |
Gets menu items by attribute
- Paramètres
-
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. |
boolean | $firstonly | If true, only returns the first item found |
- Renvoie
- MenuItem|MenuItem[] An array of menu item objects or a single object if the $firstonly parameter is true
- Depuis
- 1.5
Références $attributes, $count, $i, $item, et $items.
◆ getMenu()
Getter for the menu array
- Renvoie
- MenuItem[]
- Depuis
- 1.5
◆ getParams()
Gets the parameter object for a certain menu item
- Paramètres
-
- Renvoie
- Registry
- Depuis
- 1.5
Références $id, et $menu.
◆ getUser()
Internal getter for the user. Returns the injected one if any, or the current one if none.
- Renvoie
- User
- Depuis
- 3.9.26
Références Factory\getUser().
◆ load()
Loads the menu items
- Renvoie
- array
- Depuis
- 1.5
◆ setActive()
Set the default item by id
- Paramètres
-
- Renvoie
- MenuItem|null The menu item representing the given ID if present or null otherwise
- Depuis
- 1.5
Références $id.
◆ setDefault()
setDefault |
( |
|
$id, |
|
|
|
$language = '*' |
|
) |
| |
Set the default item by id and language code.
- Paramètres
-
integer | $id | The menu item id. |
string | $language | The language code (since 1.6). |
- Renvoie
- boolean True if a menu item with the given ID exists
- Depuis
- 1.5
Références $id, et $language.
◆ setUser()
Setter for the current user used to build menu.
- Paramètres
-
User | $user | The new user to set. |
- Renvoie
- null
- Depuis
- 3.9.26
Références $user.
◆ $_active
◆ $_default
◆ $_items
◆ $instances
◆ $storedUser
La documentation de cette classe a été générée à partir du fichier suivant :