Home > SYS_HeaderMenu > insertSystemHeaderMenuItem
SYS_HeaderMenu.insertSystemHeaderMenuItem() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Insert a system header menu item at the specified position
Signature
function insertSystemHeaderMenuItem(
env: ESYS_HeaderMenuEnvironment,
id: Array<string>,
props: {
title: string;
registerFn?: string;
menuItems?: Array<ISYS_HeaderMenuSub1MenuItem | ISYS_HeaderMenuSub2MenuItem | null>;
insertDividerBefore?: boolean;
insertDividerAfter?: boolean;
insertBefore?: string;
crossDividerWhenInsert?: boolean;
},
): Promise<string | undefined>;2
3
4
5
6
7
8
9
10
11
12
13
Parameters
Parameter | Type | Description |
|---|---|---|
env | Environment | |
id | Array<string> | Menu item ID tree. It will match menu items by hierarchy in array order and use the last element of the array as the ID of the menu item to insert |
props | { title: string; registerFn?: string; menuItems?: Array<ISYS_HeaderMenuSub1MenuItem | ISYS_HeaderMenuSub2MenuItem | null>; insertDividerBefore?: boolean; insertDividerAfter?: boolean; insertBefore?: string; crossDividerWhenInsert?: boolean } | Other parameters |
Returns
Promise<string | undefined>
The ID of the header menu item. Whether a separator is inserted does not affect the return value of the operation. The IDs of sub-items in menuItems are not included
Remarks
This API adds a sub-menu under an existing system first-level menu. First-level menus cannot be added or modified. The id array should contain at least 2 values
This API forces the ID of the newly created system header menu to include the extension UUID. For example, an input id = 'example' will be automatically rewritten to e143d88179874e7f851cc890cd22fc71|example. To remove this menu later, enter the rewritten name
This API cannot add any sub-menu under the **Advanced** menu
Sub-menus added by this API are placed at the end of the original menu by default, unless the props.insertBefore parameter is specified
Note: This API requires the user to enable the extension external interaction permission, if not enabled, it will always throw Error
Non-public API usage notice: This API is provided as-is without additional documentation for parameters. Parameters may be changed in a breaking manner in any version without notice.