public function onSetupEmployeesAreaMainMenu(array &$menu) : void

Fires before displaying the main menu in the Employees Area.


Description

Trigger hook to allow the plugins to alter the items of the main menu displayed within the Employees Area.

Here it is possible to attach new items or detach/edit existing ones.

The items of the menu are associative arrays, which should specify the following attributes:

Name Type Description
active boolean Whether the menu item button is clickable or not.
title string The title to display within the button.
icon string The icon to display before the button title.
query array An array of query attributes to be added within the URL.

 The new items to push within the array must be registered with a unique key.


Parameters

&$menu

(array)  The main menu array.

Return Value

None.


Example

The example below replicates the "Coupons" menu item of the sidebar also under the main menu.

/**
 * Trigger hook to allow the plugins to alter the items of the main menu
 * displayed within the Employees Area.
 *
 * @param   array  &$menu  The main menu.
 *
 * @return  void
 */
public function onSetupEmployeesAreaMainMenu(&$menu)
{
    // include the coupon codes item within the main menu
    $menu['coupons'] = [
        'separator' => false,
        'title'     => JText::_('VAPEMPCOUPONSTITLE'),
        'icon'      => null,
        'query'     => [
            'view' => 'empcoupons',
        ],
    ];
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-08 09:20
Helpful?