AbstractMenu
abstract class AbstractMenu
Menu class
Properties
protected MenuItem[]
Since: 4.0.0
|
$items | Array to hold the menu items |
|
protected int[]
Since: 4.0.0
|
$default | Identifier of the default menu item. Key of the array is the language. |
|
protected int
Since: 4.0.0
|
$active | Identifier of the active menu item |
|
static AbstractMenu[]
deprecated
Since: 1.7
|
$instances | Menu instances container. |
|
protected User
Since: 3.9.26
|
$storedUser | User object to check access levels for |
Methods
Class constructor
Set the default item by id and language code.
Get the default item by language code.
Gets menu items by attribute
Gets the parameter object for a certain menu item
Method to check Menu object authorization against an access control object and optionally an access extension object
Loads the menu items
Internal getter for the user. Returns the injected one if any, or the current one if none.
Details
static AbstractMenu
getInstance(string $client, array $options = [])
deprecated
deprecated 4.3 will be removed in 6.0 Use the MenuFactoryInterface from the container instead Example: Factory::getContainer()->get(MenuFactoryInterface::class)->createMenu($client, $options)
Returns a Menu object
bool
setDefault(int $id, string $language = '*')
Set the default item by id and language code.
MenuItem|MenuItem[]
getItems(mixed $attributes, mixed $values, bool $firstonly = false)
Gets menu items by attribute
bool
authorise(int $id)
Method to check Menu object authorization against an access control object and optionally an access extension object
protected User
getUser()
Internal getter for the user. Returns the injected one if any, or the current one if none.
User|null
__get(string $propName)
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.