Joomla3开发教程

Menu Component 事件

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



作者:张敏
原文:http://www.joomlachina.cn/shouce/doc/1916?article_id=1962

获取最新资讯

© 广州市番禺区新造草云信息技术咨询服务部版权所有。
粤ICP备13002429号.

Joomla系列教程

站内链接