English (United Kingdom)
Knowledge Base  >  Vik Restaurants  >  Hooks  >  Admin Menu  >  Define Menu Type

apply_filters( 'vikrestaurants_before_define_menu_type', string $menuType )

Fires while fetching the type of menu to use for the back-end of VikRestaurants.


Description

Plugins can use this filter to change the type of menu at runtime.

By default, VikRestaurants supports only 2 types of menu:

  • horizontal, placed above the plugin contents (default one);
  • leftboard, placed on the left side.

In case you wish to create your own layout, you can define all the required classes here:

/wp-content/plugins/vikrestaurants/site/helpers/library/menu/[MENU_TYPE]/

All the layouts should be placed here instead:

/wp-content/plugins/vikrestaurants/admin/layouts/menu/[MENU_TYPE]/

In case the specified layout doesn't exist, an exception will be thrown.


Parameters

$menuType

(string)  The type of the menu to use.


Example

The example below explains how to use the leftboard layout in place of the default one.

/**
 * Trigger filter to allow the plugins to choose a specific type to
 * use for the layout of the back-end menu.
 *
 * @param  string  $menuType  The menu type to use.
 */
add_filter('vikrestaurants_before_define_menu_type', function($menuType)
{
    return 'leftboard';
});

Changelog

Version Description
1.0 Introduced.
Last Update: 2021-01-24
Helpful?
See Also: