Wiki source code of Menu Extension Points
Last modified by Vincent Massol on 2024/11/19 16:15
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
2.3 | 1 | {{toc start="2"/}} |
| 2 | |||
| |
2.8 | 3 | == Use Cases == |
| 4 | |||
| |
2.12 | 5 | {{usecase}} |
| 6 | Be able to easily extend the menu: | ||
| 7 | * Add new entries in the 'Add' submenu, like 'Add Blog Post'; | ||
| 8 | * Add new entries in 'More action' submenu; | ||
| 9 | * etc. | ||
| 10 | {{/usecase}} | ||
| 11 | |||
| 12 | {{usecase}} | ||
| 13 | Make sure we can define different menus for different modes ('edit mode menu' contains different entries than 'view mode menu') | ||
| 14 | {{/usecase}} | ||
| 15 | |||
| 16 | {{usecase}} | ||
| 17 | Make sure we can define different menus for different spaces (we could have application specific menus) | ||
| 18 | {{/usecase}} | ||
| 19 | |||
| 20 | {{usecase}} | ||
| 21 | Make sure we can define an unlimited number of menus (we could have a GlobalMenu, ContentMenu, NavigationMenu or just one menu) | ||
| 22 | {{/usecase}} | ||
| 23 | |||
| 24 | {{usecase}} | ||
| |
2.14 | 25 | Make sure a submenu is not highly tight from a certain menu entry ('Add' submenu could be placed in GlobalMenu or ContentMenu) |
| |
2.12 | 26 | {{/usecase}} |
| 27 | |||
| 28 | {{usecase}} | ||
| |
2.14 | 29 | Be able to reorganise the entries with drag&drop (position is relative) |
| 30 | {{/usecase}} | ||
| 31 | |||
| 32 | {{usecase}} | ||
| |
2.12 | 33 | Make sure the developer can easily extend by adding both menu entries (links) and submenus |
| 34 | {{/usecase}} | ||
| 35 | |||
| |
2.13 | 36 | {{usecase}} |
| 37 | Make sure the the order of entries is preserved ('Wiki - Space - Page'; 'Delete' entry should be the last one in the submenu; etc.) | ||
| 38 | {{/usecase}} | ||
| 39 | |||
| 40 | == Alternatives == | ||
| |
2.8 | 41 | |
| |
2.13 | 42 | === Extensions Points === |
| |
2.3 | 43 | |
| |
2.13 | 44 | ==== Layout ==== |
| |
2.3 | 45 | |
| |
4.2 | 46 | (% class="table table-bordered" %) |
| 47 | |=(% width="10%" %)ID |=(% colspan="2" %) UIXP |=(% width="10%" %) VM | ||
| 48 | |#headerglobal |(% class="alert-success" colspan="2" %)##org.xwiki.platform.template.header.after## | global.vm | ||
| 49 | |#leftPanels |(% class="alert-success" colspan="2" %)##platform.panels.leftPanels## | leftPanels.vm | ||
| 50 | | |(% class="alert-danger" %)##org.xwiki.platform.template.content## |(% class="alert-danger" %)##org.xwiki.platform.content## |\\ | ||
| 51 | |#rightPanels |(% class="alert-success" colspan="2" %)##platform.panels.rightPanels## | rightPanels.vm | ||
| 52 | | |(% class="alert-danger" %)##org.xwiki.platform.template.footer## |(% class="alert-danger" %)##org.xwiki.platform.footer## |\\ | ||
| |
2.3 | 53 | |
| |
2.13 | 54 | ==== Menus ==== |
| |
2.3 | 55 | |
| |
4.2 | 56 | (% class="table table-bordered" %) |
| 57 | |=(% width="25%" %)A |=(% width="25%" %)B |=(% width="25%" %)C |=(% width="25%" %) D | ||
| 58 | |(% class="alert-danger" %)##org.xwiki.platform.template.header.menu## |(% class="alert-danger" %)##org.xwiki.platform.menu.globalMenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.header## |(% class="alert-danger" %)##org.xwiki.platform.menu.primary## | ||
| 59 | |(% class="alert-danger" %)##org.xwiki.platform.template.content.menu## |(% class="alert-danger" %)##org.xwiki.platform.menu.contentMenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.content## |(% class="alert-danger" %)##org.xwiki.platform.menu.secondary## | ||
| |
2.3 | 60 | |
| |
2.13 | 61 | ==== SubMenus ==== |
| |
2.4 | 62 | |
| |
4.2 | 63 | (% class="table table-bordered" %) |
| 64 | |=(% width="25%" %)E |=(% width="25%" %)F |=(% width="25%" %)G |=(% width="25%" %)H | ||
| 65 | |(% class="alert-danger" %)##org.xwiki.platform.menu.header.menu## |(% class="alert-danger" %)##org.xwiki.platform.menu.headermenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.header## |(% class="alert-danger" %)##org.xwiki.platform.menu.primary## | ||
| 66 | |(% class="alert-danger" %)##org.xwiki.platform.menu.content.menu## |(% class="alert-danger" %)##org.xwiki.platform.menu.contentmenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.content## |(% class="alert-danger" %)##org.xwiki.platform.menu.secondary## | ||
| 67 | |(% class="alert-danger" %)##org.xwiki.platform.menu.add.submenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.addsubmenu## |(% class="alert-danger" colspan="2" %)##org.xwiki.platform.menu.add## | ||
| 68 | |(% class="alert-danger" %)##org.xwiki.platform.menu.wiki.submenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.wikisubmenu## |(% class="alert-danger" colspan="2" %)##org.xwiki.platform.menu.wiki## | ||
| 69 | |(% class="alert-danger" %)##org.xwiki.platform.menu.space.submenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.spacesubmenu## |(% class="alert-danger" colspan="2" %)##org.xwiki.platform.menu.space## | ||
| 70 | |(% class="alert-danger" %)##org.xwiki.platform.menu.page.submenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.pagesubmenu## |(% class="alert-danger" colspan="2" %)##org.xwiki.platform.menu.page## | ||
| 71 | |(% class="alert-danger" %)##org.xwiki.platform.menu.profile.submenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.profilesubmenu## |(% class="alert-danger" colspan="2" %)##org.xwiki.platform.menu.profile## | ||
| 72 | |(% class="alert-danger" %)##org.xwiki.platform.menu.edit.submenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.editsubmenu## |(% class="alert-danger" colspan="2" %)##org.xwiki.platform.menu.edit## | ||
| 73 | |(% class="alert-danger" %)##org.xwiki.platform.menu.other.submenu## |(% class="alert-danger" %)##org.xwiki.platform.menu.othersubmenu## |(% class="alert-danger" colspan="2" %)##org.xwiki.platform.menu.other## | ||
| |
2.13 | 74 | |
| 75 | === Menu Class === | ||
| |
2.14 | 76 | |
| |
2.15 | 77 | {{warning}} |
| 78 | Related proposal [[Menu Creator>>Improvements.MenuCreator]] | ||
| 79 | {{/warning}} | ||
| 80 | |||
| 81 | * Have a ##MenuClass## | ||
| |
2.16 | 82 | ** name/id: string |
| |
2.14 | 83 | * Have a ##MenuEntryClass## |
| |
2.15 | 84 | ** name/id: string |
| 85 | ** label/prettyname: string or (empty if separator) | ||
| 86 | ** target: (document reference) or URL or (empty if submenu) | ||
| |
2.14 | 87 | ** icon: string (could be optional depending on the skin and also might need to accommodate different sizes) or empty |
| 88 | ** order | ||
| |
2.15 | 89 | *** parent: document/id reference - have a tree like hierarchy - vertical order |
| 90 | *** after: document/id reference - horizontal order | ||
| |
2.17 | 91 | *** (alternative) position: number - 200 |
| |
2.15 | 92 | ** (optional) type: link or submenu or separator (can be identified from label and target) |
| |
2.14 | 93 | |
| |
2.15 | 94 | Example: |
| |
4.2 | 95 | |
| |
2.15 | 96 | * Menu.MainMenu contains a MenuClass XObject |
| 97 | ** id: org.xwiki.platform.menu.MainMenu | ||
| 98 | * (Menu.AddEntry contains a MenuEntryClass XObject) or (Menu.MainMenu contains a MenuEntryClass XObject) | ||
| 99 | ** id: org.xwiki.platform.menu.AddEntry | ||
| 100 | ** label: 'Add' | ||
| 101 | ** target: - | ||
| 102 | ** icon: add | ||
| 103 | ** parent: org.xwiki.platform.menu.MainMenu | ||
| 104 | ** after: - (first element) | ||
| 105 | * (Menu.AddPageEntry contains a MenuEntryClass XObject) or (Menu.MainMenu contains a MenuEntryClass XObject) | ||
| 106 | ** id: org.xwiki.platform.menu.AddPageEntry | ||
| 107 | ** label: $services.localization.render('core.menu.create.page') ('Page') | ||
| 108 | ** target: $doc.getURL('create') | ||
| 109 | ** icon: page_white_add | ||
| 110 | ** parent: org.xwiki.platform.menu.AddEntry | ||
| 111 | ** after: org.xwiki.platform.menu.AddSpaceEntry | ||
| |
3.1 | 112 | |
| 113 | * Question: How do you tell where to display Menu.MainMenu? |