You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example shows how to migrate an `example-image.png` located in `public/var/site/storage/images/3/8/3/0/383-1-eng-GB` without manually placing it in the appropriate path.
- Review the [Symfony performance documentation]([[= symfony_doc =]]/performance.html) and apply matching suggestions, including OPCache configuration if enabled.
Copy file name to clipboardExpand all lines: docs/templating/components.md
+23-5Lines changed: 23 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,12 @@ month_change: true
8
8
Twig Components are widgets (for example, **My dashboard** blocks from Headless edition) and HTML code (for example, a tag for loading JS or CSS files) that you can inject into the existing templates to customize and extend the user interface.
9
9
They are combined into groups that are rendered in designated templates.
10
10
11
-
Built-in Twig Component groups are available for the [back office](custom_components.md), but you can create your own for use anywhere.
11
+
Twig Component groups are available for:
12
12
13
-
To learn which groups are available in a given view, use the [integration with Symfony Profiler](#symfony-profiler-integration).
13
+
-[back office](custom_components.md)
14
+
-[storefront](customize_storefront_layout.md)
15
+
16
+
To learn which groups are available in a given view, use the [integration Symfony Profiler](#symfony-profiler-integration).
14
17
15
18
## Create Twig Component
16
19
@@ -44,23 +47,38 @@ ibexa_twig_components:
44
47
# Component name
45
48
google_tag_manager:
46
49
type: script
50
+
priority: 50
47
51
arguments:
48
52
src: 'https://...'
49
53
```
50
54
51
-
The Component priority cannot be specified when using the YAML configuration, but it allows you to use the built-in components to quickly achieve common goals.
55
+
YAML configuration allows you to use the built-in components to quickly achieve common goals.
52
56
53
57
You can use an unique group name when creating a Twig Component to create your own group.
54
58
55
59
## Built-in components
56
60
57
61
| Name | Description | YAML type |
58
62
|---|---|---|
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` |
59
66
| [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` |
60
67
| [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`
61
68
| [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` |
69
+
70
+
For the menu component, the following properties are available:
| 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).
As an example, to change the cart display when it contains no products, you need to override `vendor/ibexa/storefront/src/bundle/Resources/views/themes/storefront/cart/component/maincart/maincart_empty_cart.html.twig` template.
0 commit comments