Skip to content

Commit c64cff4

Browse files
authored
[Twig Components] Added Menu component (#2799)
* Docs: Add Menu component to Twig Components documentation * Docs: Extend Twig Components YAML example with Menu component
1 parent dbe9d5c commit c64cff4

File tree

2 files changed

+47
-25
lines changed

2 files changed

+47
-25
lines changed
Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,24 @@
11
ibexa_twig_components:
22
admin-ui-user-menu:
3-
custom-html-component:
4-
type: html
5-
priority: 0
6-
arguments:
7-
content: '<b>Hello world!</b>'
8-
custom-template-component:
9-
type: template
10-
priority: 50
11-
arguments:
12-
template: '@ibexadesign/ui/component/user_thumbnail/user_thumbnail.html.twig'
13-
parameters:
14-
user_content:
15-
name: "Thumbnail"
16-
thumbnail:
17-
resource: https://placecats.com/100/100
183
custom-controller-component:
194
type: controller
205
arguments:
216
controller: '\App\Controller\MyController::requestAction'
227
parameters:
238
parameter1: 'custom'
249
parameter2: true
25-
admin-ui-stylesheet-head:
26-
custom-link-component:
27-
type: stylesheet
10+
custom-html-component:
11+
type: html
12+
priority: 0
2813
arguments:
29-
href: 'https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&amp;display=fallback'
30-
rel: stylesheet
31-
crossorigin: anonymous
32-
integrity: sha384-LN/mLhO/GN6Ge8ZPvI7uRsZpiXmtSkep+aFlJcHa8by4TvA34o1am9sa88eUzKTD
33-
type: text/css
14+
content: '<b>Hello world!</b>'
15+
admin-ui-user-menu:
16+
duplicated_user_menu:
17+
type: menu
18+
arguments:
19+
name: ezplatform_admin_ui.menu.user
20+
template: '@ibexadesign/ui/menu/user.html.twig'
21+
depth: 1
3422
admin-ui-script-head:
3523
custom-script-component:
3624
type: script
@@ -41,3 +29,23 @@ ibexa_twig_components:
4129
async: true
4230
integrity: sha384-Ewi2bBDtPbbu4/+fs8sIbBJ3zVl0LDOSznfhFR/JBK+SzggdRdX8XQKauWmI9HH2
4331
type: text/javascript
32+
admin-ui-stylesheet-head:
33+
custom-link-component:
34+
type: stylesheet
35+
arguments:
36+
href: 'https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&amp;display=fallback'
37+
rel: stylesheet
38+
crossorigin: anonymous
39+
integrity: sha384-LN/mLhO/GN6Ge8ZPvI7uRsZpiXmtSkep+aFlJcHa8by4TvA34o1am9sa88eUzKTD
40+
type: text/css
41+
admin-ui-global-search:
42+
custom-template-component:
43+
type: template
44+
priority: 50
45+
arguments:
46+
template: '@ibexadesign/ui/component/user_thumbnail/user_thumbnail.html.twig'
47+
parameters:
48+
user_content:
49+
name: "Thumbnail"
50+
thumbnail:
51+
resource: https://placecats.com/100/100

docs/templating/components.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,25 @@ You can use an unique group name when creating a Twig Component to create your o
6060

6161
| Name | Description | YAML type |
6262
|---|---|---|
63+
| [Controller](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/ControllerComponent.php) | Renders a Symfony controller |`controller` |
64+
| [HTML](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/HtmlComponent.php) | Renders static HTML |`html` |
65+
| [Menu](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/MenuComponent.php) | Renders a [menu](https://symfony.com/bundles/KnpMenuBundle/current/index.html) |`menu` |
6366
| [Script](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/ScriptComponent.php) | Renders a [`<script>` tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script) | `script` |
6467
| [Stylesheet](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/LinkComponent.php) | Renders a [`<link>` tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link) | `stylesheet`
6568
| [Template](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/TemplateComponent.php) | Renders a Twig template|`template` |
66-
| [Controller](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/ControllerComponent.php) | Renders a Symfony controller |`controller` |
67-
| [HTML](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/HtmlComponent.php) | Renders static HTML |`html` |
69+
70+
For the menu component, the following properties are available:
71+
72+
| parameter | type | required | description |
73+
|-----------|----------------------|----------|--------------------------------|
74+
| name | string | yes | Menu name |
75+
| options | array<string, mixed> | no | Options passed to menu builder |
76+
| path | string[] | no | Path to starting node |
77+
| template | string | no | Template used to render menu |
78+
| depth | int | no | Menu depth limit |
79+
80+
The menu component, same as [back office menus](back_office_menus.md), relies on the [KnpMenuBundle](https://symfony.com/bundles/KnpMenuBundle/current/index.html).
81+
For more information about the available properties, refer to the [official documentation of the bundle](https://symfony.com/bundles/KnpMenuBundle/current/index.html#create-your-first-menu).
6882

6983
## Example
7084

0 commit comments

Comments
 (0)