SiteMenu
扩展自 AbstractMenu 实现 CacheControllerFactoryAwareInterface菜单类
自版本 |
1.5 |
---|---|
包 |
Joomla CMS |
方法
__construct
类构造函数
__construct(mixed||string|int options = []) :
自版本 |
1.5 |
---|
参数
- options
array<string|int, mixed>
配置选项数组。
返回值
mixed
__get
用户对象的魔法获取器。如果注入,则返回注入的对象;如果没有,则返回当前对象。
__get( propName) : \Joomla\CMS\User\User|null
使用魔法获取器在停止在菜单对象构造时存储用户对象时保留向后兼容性。由于用户属性不再初始化,因此此获取器可确保任何扩展此类的类仍可以使用 $instance->user 并获取正确的值。
自版本 |
3.9.26 |
---|
参数
- propName
string
缺少或受保护的属性的名称。
返回值
User|null
authorise
用于检查菜单对象授权是否针对访问控制对象(以及可选的访问扩展对象)的方法
authorise( id) :
自版本 |
1.5 |
---|
参数
- id
int
菜单 ID
返回值
bool
getActive
按 ID 获取菜单项。
getActive() : \Joomla\CMS\Menu\MenuItem|null
getCacheControllerFactory
获取 CacheControllerFactoryInterface。
getCacheControllerFactory() : \Joomla\CMS\Cache\CacheControllerFactoryInterface
getDefault
按 ID 获取菜单项
getDefault( language = '*') : \Joomla\CMS\Menu\MenuItem|null
getInstance
返回一个 Menu 对象
getInstance( client, mixed||string|int options = []) : \Joomla\CMS\Menu\AbstractMenu
自版本 |
1.5 |
---|---|
抛出 |
|
已弃用 |
4.3 将在 6.0 中删除 使用容器中的 MenuFactoryInterface 代替 例如:Factory::getContainer()->get(MenuFactoryInterface::class)->createMenu($client, $options) |
参数
- client
string
客户端的名称- options
array<string|int, mixed>
选项的关联数组
返回值
AbstractMenu
菜单对象。
getItem
按 ID 获取菜单项
getItem( id) : \Joomla\CMS\Menu\MenuItem|null
getItems
按属性获取菜单项
getItems( attributes, values, firstonly = false) : \Joomla\CMS\Menu\MenuItem|\Joomla\CMS\Menu\MenuItem[]
getMenu
菜单数组的获取器
getMenu() : \Joomla\CMS\Menu\MenuItem||string|int
getParams
获取特定菜单项的参数对象
getParams( id) : \Joomla\Registry\Registry
自版本 |
1.5 |
---|
参数
- id
int
项 ID
返回值
Registry
getUser
用户的内部获取器。如果注入,则返回注入的对象;如果没有,则返回当前对象。
getUser() : \Joomla\CMS\User\User
load
将整个菜单表加载到内存中。
load() :
自版本 |
1.5 |
---|
返回值
bool
成功时为 true,失败时为 false
setActive
按 ID 设置默认项
setActive( id) : \Joomla\CMS\Menu\MenuItem|null
setCacheControllerFactory
设置要使用的缓存控制器工厂。
setCacheControllerFactory(\Joomla\CMS\Cache\CacheControllerFactoryInterface cacheControllerFactory = null) :
setDefault
按 ID 和语言代码设置默认项。
setDefault( id, language = '*') :
自版本 |
1.5 |
---|
参数
- id
int
菜单项 ID。- language
string
语言代码(自 1.6 版本起)。
返回值
bool
如果存在具有给定 ID 的菜单项,则为 true
setUser
用于构建菜单的当前用户的设置器。
setUser(\Joomla\CMS\User\User user) :
属性
default
默认菜单项的标识符。数组的键是语言。
自版本 |
4.0.0 |
---|
类型
array<string|int, int>
active
活动菜单项的标识符
自版本 |
4.0.0 |
---|
类型
int
instances
菜单实例容器。
自版本 |
1.7 |
---|---|
已弃用 |
4.3 将在 6.0 中删除 使用容器中的 MenuFactoryInterface 代替 例如:Factory::getContainer()->get(MenuFactoryInterface::class)->createMenu($client, $options) |
类型
array<string|int, AbstractMenu>
itemsLoaded
用于检查菜单项是否已加载的标志
自版本 |
4.0.0 |
---|
类型
bool
cacheControllerFactory
CacheControllerFactoryInterface
db
数据库驱动程序
自版本 |
3.5 |
---|
类型
DatabaseDriver