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