File tree Expand file tree Collapse file tree 7 files changed +81
-0
lines changed Expand file tree Collapse file tree 7 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ # Menu Item Example
2+
3+ This example demonstrates how to register a Menu Item.
4+
5+ The example includes:
6+
7+ - Action Menu Item Registration
8+ - Link Menu Item Registration
9+ - Entity Menu Item Registration
Original file line number Diff line number Diff line change 1+ import { UmbMenuItemActionApiBase } from '@umbraco-cms/backoffice/menu' ;
2+
3+ /**
4+ * Example menu item action API
5+ * This action will log "Hello world" to the console when executed.
6+ */
7+ export class ExampleActionMenuItemApi extends UmbMenuItemActionApiBase < never > {
8+ /**
9+ * This method is executed when the menu item is clicked
10+ */
11+ override async execute ( ) {
12+ console . log ( 'Hello world' ) ;
13+ }
14+ }
15+
16+ // Declare an `api` export so the Extension Registry can initialize this class
17+ export { ExampleActionMenuItemApi as api } ;
Original file line number Diff line number Diff line change 1+ import { UMB_CONTENT_MENU_ALIAS } from '@umbraco-cms/backoffice/document' ;
2+
3+ export const manifests : Array < UmbExtensionManifest > = [
4+ {
5+ type : 'menuItem' ,
6+ kind : 'action' ,
7+ alias : 'Example.MenuItem.Action' ,
8+ name : 'Example Action Menu Item' ,
9+ api : ( ) => import ( './action-menu-item.api.js' ) ,
10+ meta : {
11+ label : 'Example Action Menu Item' ,
12+ icon : 'icon-hammer' ,
13+ menus : [ UMB_CONTENT_MENU_ALIAS ] ,
14+ } ,
15+ } ,
16+ ] ;
Original file line number Diff line number Diff line change 1+ import { UMB_CONTENT_MENU_ALIAS } from '@umbraco-cms/backoffice/document' ;
2+
3+ export const manifests : Array < UmbExtensionManifest > = [
4+ {
5+ type : 'menuItem' ,
6+ alias : 'Example.MenuItem.Entity' ,
7+ name : 'Example Entity Menu Item' ,
8+ meta : {
9+ label : 'Example Entity Menu Item' ,
10+ icon : 'icon-wand' ,
11+ entityType : 'example-entity-type' ,
12+ menus : [ UMB_CONTENT_MENU_ALIAS ] ,
13+ } ,
14+ } ,
15+ ] ;
Original file line number Diff line number Diff line change 1+ import { manifests as actionManifests } from './action/manifests.js' ;
2+ import { manifests as entityManifests } from './entity/manifests.js' ;
3+ import { manifests as linkManifests } from './link/manifests.js' ;
4+
5+ export const manifests = [ ...actionManifests , ...entityManifests , ...linkManifests ] ;
Original file line number Diff line number Diff line change 1+ import { UMB_CONTENT_MENU_ALIAS } from '@umbraco-cms/backoffice/document' ;
2+
3+ export const manifests : Array < UmbExtensionManifest > = [
4+ {
5+ type : 'menuItem' ,
6+ kind : 'link' ,
7+ alias : 'Example.MenuItem.ExternalLink' ,
8+ name : 'Example External Link Menu Item' ,
9+ meta : {
10+ label : 'Example Link Menu Item' ,
11+ icon : 'icon-link' ,
12+ href : 'https://' ,
13+ menus : [ UMB_CONTENT_MENU_ALIAS ] ,
14+ } ,
15+ } ,
16+ ] ;
Original file line number Diff line number Diff line change 1+ #Tree Menu Item
2+
3+ See the Tree Example of how to register a tree and use it as a menu item in the sidebar.
You can’t perform that action at this time.
0 commit comments