Skip to content

Commit 0ba37ee

Browse files
authored
Merge pull request #7334 from bszyman/sections-pr
Sections, Section Views and Section Sidebar Apps
2 parents f9f8e83 + bb699c5 commit 0ba37ee

File tree

5 files changed

+286
-93
lines changed

5 files changed

+286
-93
lines changed
298 KB
Loading
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: >-
3-
An overview of the available extension types related to sections.
3+
A comprehensive summary of the available extension types associated with sections.
44
---
55

66
# Extension Types: Sections
Lines changed: 132 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,158 @@
1+
---
2+
description: >-
3+
Use Section Sidebar extensions to add navigation, coordinate Section Views, and provide additional functionality inside Section extensions.
4+
---
5+
16
# Section Sidebar
27

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.
612

713
<figure><img src="../../../../.gitbook/assets/section-sidebar.svg" alt=""><figcaption><p>Section Sidebar</p></figcaption></figure>
814

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.
1018

1119
<figure><img src="../../../../.gitbook/assets/section-sidebar-apps.svg" alt=""><figcaption><p>Section Sidebar Apps</p></figcaption></figure>
1220

13-
**Manifest**
21+
### Custom Sidebar App Example
1422

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.
2826

29-
**Default Element**
27+
Sidebar Section extension authors may specify where the Section Sidebar app appears using
28+
[extension conditions](../condition.md).
3029

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+
}
3342
```
43+
{% endcode %}
3444

35-
## **Menu Sidebar App**
36-
37-
**Sidebar Menu**:
45+
### Menu Sidebar App Examples
3846

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.
4148

4249
<figure><img src="../../../../.gitbook/assets/section-menu-sidebar-app.svg" alt=""><figcaption><p>Menu Sidebar App</p></figcaption></figure>
4350

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
4953
{
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+
}]
6466
}
6567
```
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+
]
7190
```
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 %}
72126

73-
**Adding Items to an existing menu**
127+
#### Adding items to an existing menu
74128

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.
76130

77131
<figure><img src="../../../../.gitbook/assets/section-sidebar-composed-apps.svg" alt=""><figcaption><p>Composed sidebar menu</p></figcaption></figure>
78132

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

Comments
 (0)