Skip to content

Commit c5e6526

Browse files
committed
Docs: Extend Twig Components YAML example with Menu component
1 parent 4e3f068 commit c5e6526

File tree

2 files changed

+45
-24
lines changed

2 files changed

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

docs/templating/components.md

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

5757
| Name | Description | YAML type |
5858
|---|---|---|
59+
| [Controller](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/ControllerComponent.php) | Renders a Symfony controller |`controller` |
60+
| [HTML](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/HtmlComponent.php) | Renders static HTML |`html` |
61+
| [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` |
5962
| [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` |
6063
| [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`
6164
| [Template](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/TemplateComponent.php) | Renders a Twig template|`template` |
62-
| [Controller](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/ControllerComponent.php) | Renders a Symfony controller |`controller` |
63-
| [HTML](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/HtmlComponent.php) | Renders static HTML |`html` |
64-
| [Menu](https://github.com/ibexa/twig-components/blob/main/src/lib/Component/MenuComponent.php) | Renders a menu based on a menu item identifier |`menu` |
65+
66+
For the menu component, the following properties are available:
67+
68+
| parameter | type | required | description |
69+
|-----------|----------------------|----------|--------------------------------|
70+
| name | string | yes | Menu name |
71+
| options | array<string, mixed> | no | Options passed to menu builder |
72+
| path | string[] | no | Path to starting node |
73+
| template | string | no | Template used to render menu |
74+
| depth | int | no | Menu depth limit |
75+
76+
The menu component, same as [back office menus](back_office_menus.md), relies on the [KnpMenuBundle](https://symfony.com/bundles/KnpMenuBundle/current/index.html).
77+
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).
6578

6679
## Example
6780

0 commit comments

Comments
 (0)