Menu
Class Menu
The main purpose of this class is to prepare params for placement/bindings button, which is often rendered by intranet.binding.menu component. The button is rendered with BX.PopupMenu. Therefore, structure of arrays here is highly influenced by structure of js-object that should be passed to BX.PopupMenu to render multi-layer menu.
To put it simply, this class prepares associative arrays that should be converted to js-objects and passed to BX.PopupMenu. And when an array with name 'items' is mentioned here, almost certainly it is js-object-like array from BX.PopupMenu.
Table of Contents
Constants
- REST_PLACEMENT_MAP = []
- SECTIONS = ['knowledge' => 'knowledge', 'script' => 'script', 'marketplace' => 'marketplace', 'other' => 'other']
- Allowed menu sections.
- USER_OPTION_LOG_CODE = 'binding_menu'
- User option code for logging opened menu items.
Methods
- getFrequencyMenuItemId() : string
- Returns most frequency (by clicking) menu item id.
- getMap() : array<string|int, mixed>
- Gets maps of binding places.
- getMenuItems() : array<string|int, array<string|int, mixed>>
- Gets available menu items by code.
- getRestMap() : array<string|int, mixed>
- Returns current binding map for REST. Contains rest placement codes divided in groups by their scope
- getRestPlacementMap() : array<string|int, mixed>
- Returns a map where keys are rest placement codes and values - intranet binding menu codes
- processMenuItemHit() : void
- Processing menu item click (logs frequency user clicks).
Constants
REST_PLACEMENT_MAP
Use the method instead
public
mixed
REST_PLACEMENT_MAP
= []
Tags
SECTIONS
Allowed menu sections.
public
mixed
SECTIONS
= ['knowledge' => 'knowledge', 'script' => 'script', 'marketplace' => 'marketplace', 'other' => 'other']
USER_OPTION_LOG_CODE
User option code for logging opened menu items.
public
mixed
USER_OPTION_LOG_CODE
= 'binding_menu'
Methods
getFrequencyMenuItemId()
Returns most frequency (by clicking) menu item id.
public
static getFrequencyMenuItemId(string $bindingId) : string
Parameters
- $bindingId : string
-
Binding id (ex: 'section:item').
Return values
stringgetMap()
Gets maps of binding places.
public
static getMap() : array<string|int, mixed>
Return values
array<string|int, mixed> —Example of returned array structure:
$result = [
'crm_switcher' => [
'items' => [
'deal' => [],
'lead' => [],
],
],
'bizproc_automation' => [
'items' => [
'deal' => [],
'lead' => [],
// this item is from another scope, but from the section with the same code
'task' => [],
],
],
];
getMenuItems()
Gets available menu items by code.
public
static getMenuItems(string $sectionCode, string $menuCode[, array<string|int, mixed> $params = [] ]) : array<string|int, array<string|int, mixed>>
Item is an associative array that represents js-object that should be passed to BX.PopupMenu to render multi-layer menu. And items is an array of these arrays. Item could be recursive and contain other items to render a nested menu section.
Parameters
- $sectionCode : string
-
Section code.
- $menuCode : string
-
Item code.
- $params : array<string|int, mixed> = []
-
Additional params:
- context Query context, mixed
- inline Inline mode, boolean, false by default
Return values
array<string|int, array<string|int, mixed>>getRestMap()
Returns current binding map for REST. Contains rest placement codes divided in groups by their scope
public
static getRestMap() : array<string|int, mixed>
Return values
array<string|int, mixed> —Example of returned array structure:
$result = [
'crm' => [
'CRM_DEAL_LIST_TOOLBAR' => [],
'CRM_LEAD_LIST_TOOLBAR' => [],
'CRM_DEAL_ROBOT_DESIGNER_TOOLBAR' => [],
'CRM_LEAD_ROBOT_DESIGNER_TOOLBAR' => [],
],
'task' => [
'TASK_ROBOT_DESIGNER_TOOLBAR' => [],
],
];
getRestPlacementMap()
Returns a map where keys are rest placement codes and values - intranet binding menu codes
public
static getRestPlacementMap() : array<string|int, mixed>
Return values
array<string|int, mixed> —Example of returned array structure:
$result = [
'CRM_DEAL_LIST_TOOLBAR' => 'CRM_SWITCHER@DEAL',
'CRM_DEAL_DETAIL_TOOLBAR' => 'CRM_DETAIL@DEAL',
'USER_PROFILE_MENU' => 'TOP_PANEL@USER_MENU',
];
processMenuItemHit()
Processing menu item click (logs frequency user clicks).
public
static processMenuItemHit(string $bindingId, string $menuItemId) : void
Parameters
- $bindingId : string
-
Binding id (ex: 'section:item').
- $menuItemId : string
-
Menu item id.