SiteMenu
Extends AbstractMenu Implements CacheControllerFactoryAwareInterfaceMenu class
since |
1.5 |
---|---|
package |
Joomla CMS |
Methods
__construct
Class constructor
__construct(mixed||string|int options = []) :
since |
1.5 |
---|
Arguments
- options
array<string|int, mixed>
An array of configuration options.
Response
mixed
__get
Magic getter for the user object. Returns the injected one if any, or the current one if none.
__get( propName) : \Joomla\CMS\User\User|null
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.
since |
3.9.26 |
---|
Arguments
- propName
string
Name of the missing or protected property.
Response
User|null
authorise
Method to check Menu object authorization against an access control object and optionally an access extension object
authorise( id) :
since |
1.5 |
---|
Arguments
- id
int
The menu id
Response
bool
getActive
Get menu item by id.
getActive() : \Joomla\CMS\Menu\MenuItem|null
getCacheControllerFactory
Get the CacheControllerFactoryInterface.
getCacheControllerFactory() : \Joomla\CMS\Cache\CacheControllerFactoryInterface
getDefault
Get menu item by id
getDefault( language = '*') : \Joomla\CMS\Menu\MenuItem|null
since |
1.6 |
---|
Arguments
- language
string
The language code.
Response
MenuItem|null
The item object or null when not found for given language
getInstance
Returns a Menu object
getInstance( client, mixed||string|int options = []) : \Joomla\CMS\Menu\AbstractMenu
since |
1.5 |
---|---|
throws |
|
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) |
Arguments
- client
string
The name of the client- options
array<string|int, mixed>
An associative array of options
Response
AbstractMenu
A menu object.
getItem
Get menu item by id
getItem( id) : \Joomla\CMS\Menu\MenuItem|null
since |
1.5 |
---|
Arguments
- id
int
The item id
Response
MenuItem|null
The item object if the ID exists or null if not found
getItems
Gets menu items by attribute
getItems( attributes, values, firstonly = false) : \Joomla\CMS\Menu\MenuItem|\Joomla\CMS\Menu\MenuItem[]
getMenu
Getter for the menu array
getMenu() : \Joomla\CMS\Menu\MenuItem||string|int
getParams
Gets the parameter object for a certain menu item
getParams( id) : \Joomla\Registry\Registry
since |
1.5 |
---|
Arguments
- id
int
The item id
Response
Registry
getUser
Internal getter for the user. Returns the injected one if any, or the current one if none.
getUser() : \Joomla\CMS\User\User
load
Loads the entire menu table into memory.
load() :
since |
1.5 |
---|
Response
bool
True on success, false on failure
setActive
Set the default item by id
setActive( id) : \Joomla\CMS\Menu\MenuItem|null
since |
1.5 |
---|
Arguments
- id
int
The item id
Response
MenuItem|null
The menu item representing the given ID if present or null otherwise
setCacheControllerFactory
Set the cache controller factory to use.
setCacheControllerFactory(\Joomla\CMS\Cache\CacheControllerFactoryInterface cacheControllerFactory = null) :
since |
4.2.0 |
---|
Arguments
- cacheControllerFactory
CacheControllerFactoryInterface
The cache controller factory to use.
Response
void
setDefault
Set the default item by id and language code.
setDefault( id, language = '*') :
since |
1.5 |
---|
Arguments
- id
int
The menu item id.- language
string
The language code (since 1.6).
Response
bool
True if a menu item with the given ID exists
setUser
Setter for the current user used to build menu.
setUser(\Joomla\CMS\User\User user) :
Properties
default
Identifier of the default menu item. Key of the array is the language.
since |
4.0.0 |
---|
Type(s)
array<string|int, int>
active
Identifier of the active menu item
since |
4.0.0 |
---|
Type(s)
int
instances
Menu instances container.
since |
1.7 |
---|---|
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) |
Type(s)
array<string|int, AbstractMenu>
itemsLoaded
Flag for checking if the menu items have been loaded
since |
4.0.0 |
---|
Type(s)
bool
cacheControllerFactory
CacheControllerFactoryInterface
db
Database driver
since |
3.5 |
---|
Type(s)
DatabaseDriver