|
| 1 | +--- |
| 2 | +description: >- |
| 3 | + Use Section Sidebar extensions to add navigation, coordinate Section Views, and provide additional functionality inside Section extensions. |
| 4 | +--- |
| 5 | + |
1 | 6 | # Section Sidebar |
2 | 7 |
|
3 | | -{% hint style="warning" %} |
4 | | -This page is a work in progress and may undergo further revisions, updates, or amendments. The information contained herein is subject to change without notice. |
5 | | -{% endhint %} |
| 8 | +[Section extensions](./section.md) can add a Section Sidebar to add navigation, coordinate subviews such as |
| 9 | +[Section View extensions](./section-view.md), and provide Section-wide functionality. |
| 10 | + |
| 11 | +Section Sidebar extensions are optional; if not defined, the Section extension defaults to a single full-screen subview. |
6 | 12 |
|
7 | 13 | <figure><img src="../../../../.gitbook/assets/section-sidebar.svg" alt=""><figcaption><p>Section Sidebar</p></figcaption></figure> |
8 | 14 |
|
9 | | -## Section Sidebar Apps <a href="#section-sidebar-apps" id="section-sidebar-apps"></a> |
| 15 | +## Section Sidebar Apps |
| 16 | + |
| 17 | +Section Sidebar extensions can be composed of **one or more** section sidebar apps. Extension authors can include common Umbraco types, such as menus and trees, or create custom sidebar apps using web components. |
10 | 18 |
|
11 | 19 | <figure><img src="../../../../.gitbook/assets/section-sidebar-apps.svg" alt=""><figcaption><p>Section Sidebar Apps</p></figcaption></figure> |
12 | 20 |
|
13 | | -**Manifest** |
| 21 | +### Custom Sidebar App Example |
14 | 22 |
|
15 | | -```typescript |
16 | | -{ |
17 | | - "type": "sectionSidebarApp", |
18 | | - "alias": "My.SectionSidebarApp", |
19 | | - "name": "My Section Sidebar App", |
20 | | - "conditions": [ |
21 | | - { |
22 | | - "alias": "Umb.Condition.SectionAlias", |
23 | | - "match": "My.Section" |
24 | | - } |
25 | | - ] |
26 | | -} |
27 | | -``` |
| 23 | +Section Sidebar extension authors can place any custom web component into the sidebar. Extension authors will need to |
| 24 | +supply the `element` property with the path of their custom web component. Specify the full path, starting from the |
| 25 | +Umbraco project root. |
28 | 26 |
|
29 | | -**Default Element** |
| 27 | +Sidebar Section extension authors may specify where the Section Sidebar app appears using |
| 28 | +[extension conditions](../condition.md). |
30 | 29 |
|
31 | | -```typescript |
32 | | -interface UmbSectionSidebarAppElement {} |
| 30 | +{% code title="umbraco-package.json" %} |
| 31 | +```json |
| 32 | +{ |
| 33 | + "type": "sectionSidebarApp", |
| 34 | + "alias": "My.SectionSidebarApp", |
| 35 | + "name": "My Section Sidebar App", |
| 36 | + "element": "/App_Plugins/<package_name>/sidebar-app.js", |
| 37 | + "conditions": [{ |
| 38 | + "alias": "Umb.Condition.SectionAlias", |
| 39 | + "match": "My.Section" |
| 40 | + }] |
| 41 | +} |
33 | 42 | ``` |
| 43 | +{% endcode %} |
34 | 44 |
|
35 | | -## **Menu Sidebar App** |
36 | | - |
37 | | -**Sidebar Menu**: |
| 45 | +### Menu Sidebar App Examples |
38 | 46 |
|
39 | | -* The Backoffice comes with a menu sidebar app that can be used to create a menu in the sidebar. |
40 | | -* The menu sidebar app will reference a menu that you have registered in the menu with a menu manifest |
| 47 | +The menu sidebar app, provided by Umbraco, can be placed in Section Sidebar extensions. It attaches to a menu defined in your manifest via the `meta:menu` property, where this value must match the `alias` value of the menu. |
41 | 48 |
|
42 | 49 | <figure><img src="../../../../.gitbook/assets/section-menu-sidebar-app.svg" alt=""><figcaption><p>Menu Sidebar App</p></figcaption></figure> |
43 | 50 |
|
44 | | -To register a new menu sidebar app, add the following to your manifest (notice the added `"kind"` and `"meta"` properties): |
45 | | - |
46 | | -**Manifest** |
47 | | - |
48 | | -```typescript |
| 51 | +{% code title="umbraco-package.json" %} |
| 52 | +```json |
49 | 53 | { |
50 | | - "type": "sectionSidebarApp", |
51 | | - "kind": "menu", |
52 | | - "alias": "My.SectionSidebarApp.MyMenu", |
53 | | - "name": "My Menu Section Sidebar App", |
54 | | - "meta": { |
55 | | - "label": "My Sidebar Menu", |
56 | | - "menu": "My.Menu" |
57 | | - }, |
58 | | - "conditions": [ |
59 | | - { |
60 | | - "alias": "Umb.Condition.SectionAlias", |
61 | | - "match": "My.Section" |
62 | | - } |
63 | | - ] |
| 54 | + "type": "sectionSidebarApp", |
| 55 | + "kind": "menu", |
| 56 | + "alias": "My.SectionSidebarApp.MyMenu", |
| 57 | + "name": "My Menu Section Sidebar App", |
| 58 | + "meta": { |
| 59 | + "label": "My Sidebar Menu", |
| 60 | + "menu": "My.Menu" |
| 61 | + }, |
| 62 | + "conditions": [{ |
| 63 | + "alias": "Umb.Condition.SectionAlias", |
| 64 | + "match": "My.Section" |
| 65 | + }] |
64 | 66 | } |
65 | 67 | ``` |
66 | | - |
67 | | -**Default Element** |
68 | | - |
69 | | -```typescript |
70 | | -interface UmbMenuSectionSidebarAppElement {} |
| 68 | +{% endcode %} |
| 69 | + |
| 70 | +In the example below, a menu extension is created and bound to the `meta:menu` (My.Menu) property, which matches the menu extension’s `alias`. The _My.Menu_ alias is also used to attach a menu item extension. |
| 71 | + |
| 72 | +{% code title="umbraco-package.json" %} |
| 73 | +```json |
| 74 | +[ |
| 75 | + { |
| 76 | + "type": "menu", |
| 77 | + "alias": "My.Menu", |
| 78 | + "name": "Section Sidebar Menu" |
| 79 | + }, |
| 80 | + { |
| 81 | + "type": "menuItem", |
| 82 | + "alias": "SectionSidebar.MenuItem1", |
| 83 | + "name": "Menu Item 1", |
| 84 | + "meta": { |
| 85 | + "label": "Menu Item 1", |
| 86 | + "menus": ["My.Menu"] |
| 87 | + } |
| 88 | + } |
| 89 | +] |
71 | 90 | ``` |
| 91 | +{% endcode %} |
| 92 | + |
| 93 | +For more information, see the documentation for the [menus](../menu.md) extension. |
| 94 | + |
| 95 | +#### Coordinating subviews with menu items |
| 96 | + |
| 97 | +Menu sidebar apps can coordinate navigation between subviews in the section extension by referencing |
| 98 | +[workspace extensions](../workspaces/workspace.md). Modify the menu item extension to include the `meta:entityType` |
| 99 | +property, and assign it the same value as a workspace view extensions' own `meta:entityType` property. |
| 100 | + |
| 101 | +{% code title="umbraco-package.json" %} |
| 102 | +```json |
| 103 | +[ |
| 104 | + { |
| 105 | + "type": "menuItem", |
| 106 | + "alias": "SectionSidebar.MenuItem1", |
| 107 | + "name": "Menu Item 1", |
| 108 | + "meta": { |
| 109 | + "label": "Menu Item 1", |
| 110 | + "menus": ["My.Menu"], |
| 111 | + "entityType": "myCustomWorkspaceView" |
| 112 | + } |
| 113 | + }, |
| 114 | + { |
| 115 | + "type": "workspace", |
| 116 | + "name": "Workspace 1", |
| 117 | + "alias": "SectionSidebar.Workspace1", |
| 118 | + "element": "/App_Plugins/<package_name>/my-custom-workspace.js", |
| 119 | + "meta": { |
| 120 | + "entityType": "myCustomWorkspaceView" |
| 121 | + } |
| 122 | + } |
| 123 | +] |
| 124 | +``` |
| 125 | +{% endcode %} |
72 | 126 |
|
73 | | -**Adding Items to an existing menu** |
| 127 | +#### Adding items to an existing menu |
74 | 128 |
|
75 | | -This will make it possible to compose a sidebar menu from multiple Apps: |
| 129 | +Authors can add their extensions to the sidebar of any Umbraco-provided section (Content, Media, Settings, etc.) by configuring `conditions` with the `SectionAlias` property. |
76 | 130 |
|
77 | 131 | <figure><img src="../../../../.gitbook/assets/section-sidebar-composed-apps.svg" alt=""><figcaption><p>Composed sidebar menu</p></figcaption></figure> |
78 | 132 |
|
79 | | -You can read more about this in the [Menu](../menu.md) article. |
| 133 | +{% code title="umbraco-package.json" %} |
| 134 | +```json |
| 135 | +{ |
| 136 | + "type": "sectionSidebarApp", |
| 137 | + "alias": "My.SectionSidebarApp", |
| 138 | + "name": "My Section Sidebar App", |
| 139 | + "element": "/App_Plugins/<package_name>/sidebar-app.js", |
| 140 | + "conditions": [{ |
| 141 | + "alias": "Umb.Condition.SectionAlias", |
| 142 | + "match": "Umb.Section.Settings" |
| 143 | + }] |
| 144 | +} |
| 145 | +``` |
| 146 | +{% endcode %} |
| 147 | + |
| 148 | +Common Umbraco-provided section aliases: |
| 149 | + |
| 150 | +| Section Aliases | |
| 151 | +|-------------------------| |
| 152 | +| Umb.Section.Content | |
| 153 | +| Umb.Section.Media | |
| 154 | +| Umb.Section.Settings | |
| 155 | +| Umb.Section.Packages | |
| 156 | +| Umb.Section.Users | |
| 157 | +| Umb.Section.Members | |
| 158 | +| Umb.Section.Translation | |
0 commit comments