教程栏目

joomla中文网出品的官方教程

In a standard installation of Joomla! we have several predefined Menu events which, when triggered, call functions in the associated plugins.

onAfterGetMenuTypeOptions

Description

Allows plugins to dynamically add menu types in the menu manager

Parameters

  • &list A reference to the object that holds all the menu types
  • MenusModelMenutypes The model instance. This is in order for functions to add their custom types to the reverse lookup (in addition to adding them in the list property) via the addReverseLookupUrl function in the model.

Example Usage

Inside your system plugin the following code will add a custom menu type:

    public function onAfterGetMenuTypeOptions(&$list, MenusModelMenutypes $model)
    {
        // Create a new Menu Type
        // Create the menu option for the component.
        $o = new JObject;
        $o->title       = 'Your Menu Type Title';
        $o->description = 'Your Menu Type Description';
        $o->request     =  [
            'option' => 'com_foobar',
            'other'  => 'option'
        ];
        $list['com_foobar'][] = $o;
        $model->addReverseLookupUrl($o);
    }

Return Value

None. Result will be omitted.

Used in files

administrator/components/com_menus/models/menutypes.php

作者: 樱木花道

Joomla程序员,从J1.5到J4.x始终都在做Joomla相关开发定制工作,有超过10年行业经验,国内Joomla扩展开发商ZMAX团队的核心成员

作者网站:ZMAX程序人

评论 (0)

  • 最新在前
  • 最佳在前

第3章 处理URL请求参数

第5章 日志

第6章 错误和调试

第10章 缓存

第14章 路由系统