Menu Extension Points
Last modified by Vincent Massol on 2024/11/19 16:15
Description
Use Cases
UC: Be able to easily extend the menu:
- Add new entries in the 'Add' submenu, like 'Add Blog Post';
- Add new entries in 'More action' submenu;
- etc.
UC: Make sure we can define different menus for different modes ('edit mode menu' contains different entries than 'view mode menu')
UC: Make sure we can define different menus for different spaces (we could have application specific menus)
UC: Make sure we can define an unlimited number of menus (we could have a GlobalMenu, ContentMenu, NavigationMenu or just one menu)
UC: Make sure a submenu is not highly tight from a certain menu entry ('Add' submenu could be placed in GlobalMenu or ContentMenu)
UC: Be able to reorganise the entries with drag&drop (position is relative)
UC: Make sure the developer can easily extend by adding both menu entries (links) and submenus
UC: Make sure the the order of entries is preserved ('Wiki - Space - Page'; 'Delete' entry should be the last one in the submenu; etc.)
Alternatives
Extensions Points
Layout
| ID | UIXP | VM | |
|---|---|---|---|
| #headerglobal | org.xwiki.platform.template.header.after | global.vm | |
| #leftPanels | platform.panels.leftPanels | leftPanels.vm | |
| org.xwiki.platform.template.content | org.xwiki.platform.content | ||
| #rightPanels | platform.panels.rightPanels | rightPanels.vm | |
| org.xwiki.platform.template.footer | org.xwiki.platform.footer | ||
Menus
| A | B | C | D |
|---|---|---|---|
| org.xwiki.platform.template.header.menu | org.xwiki.platform.menu.globalMenu | org.xwiki.platform.menu.header | org.xwiki.platform.menu.primary |
| org.xwiki.platform.template.content.menu | org.xwiki.platform.menu.contentMenu | org.xwiki.platform.menu.content | org.xwiki.platform.menu.secondary |
SubMenus
| E | F | G | H |
|---|---|---|---|
| org.xwiki.platform.menu.header.menu | org.xwiki.platform.menu.headermenu | org.xwiki.platform.menu.header | org.xwiki.platform.menu.primary |
| org.xwiki.platform.menu.content.menu | org.xwiki.platform.menu.contentmenu | org.xwiki.platform.menu.content | org.xwiki.platform.menu.secondary |
| org.xwiki.platform.menu.add.submenu | org.xwiki.platform.menu.addsubmenu | org.xwiki.platform.menu.add | |
| org.xwiki.platform.menu.wiki.submenu | org.xwiki.platform.menu.wikisubmenu | org.xwiki.platform.menu.wiki | |
| org.xwiki.platform.menu.space.submenu | org.xwiki.platform.menu.spacesubmenu | org.xwiki.platform.menu.space | |
| org.xwiki.platform.menu.page.submenu | org.xwiki.platform.menu.pagesubmenu | org.xwiki.platform.menu.page | |
| org.xwiki.platform.menu.profile.submenu | org.xwiki.platform.menu.profilesubmenu | org.xwiki.platform.menu.profile | |
| org.xwiki.platform.menu.edit.submenu | org.xwiki.platform.menu.editsubmenu | org.xwiki.platform.menu.edit | |
| org.xwiki.platform.menu.other.submenu | org.xwiki.platform.menu.othersubmenu | org.xwiki.platform.menu.other | |
Menu Class
- Have a MenuClass
- name/id: string
- Have a MenuEntryClass
- name/id: string
- label/prettyname: string or (empty if separator)
- target: (document reference) or URL or (empty if submenu)
- icon: string (could be optional depending on the skin and also might need to accommodate different sizes) or empty
- order
- parent: document/id reference - have a tree like hierarchy - vertical order
- after: document/id reference - horizontal order
- (alternative) position: number - 200
- (optional) type: link or submenu or separator (can be identified from label and target)
Example:
- Menu.MainMenu contains a MenuClass XObject
- id: org.xwiki.platform.menu.MainMenu
- (Menu.AddEntry contains a MenuEntryClass XObject) or (Menu.MainMenu contains a MenuEntryClass XObject)
- id: org.xwiki.platform.menu.AddEntry
- label: 'Add'
- target: -
- icon: add
- parent: org.xwiki.platform.menu.MainMenu
- after: - (first element)
- (Menu.AddPageEntry contains a MenuEntryClass XObject) or (Menu.MainMenu contains a MenuEntryClass XObject)
- id: org.xwiki.platform.menu.AddPageEntry
- label: $services.localization.render('core.menu.create.page') ('Page')
- target: $doc.getURL('create')
- icon: page_white_add
- parent: org.xwiki.platform.menu.AddEntry
- after: org.xwiki.platform.menu.AddSpaceEntry
- Question: How do you tell where to display Menu.MainMenu?
Vincent Massol