Skip to content

Commit e14e8f2

Browse files
Twig Component follow ups (#2792)
* Added Priority for YAML configuration * Added doc for storefront groups * Adjusted paths * Update docs/templating/layout/customize_storefront_layout.md Co-authored-by: julitafalcondusza <[email protected]> --------- Co-authored-by: julitafalcondusza <[email protected]>
1 parent 1208668 commit e14e8f2

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

code_samples/back_office/components/twig_components.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ ibexa_twig_components:
22
admin-ui-user-menu:
33
custom-html-component:
44
type: html
5+
priority: 0
56
arguments:
67
content: '<b>Hello world!</b>'
78
custom-template-component:
89
type: template
10+
priority: 50
911
arguments:
1012
template: '@ibexadesign/ui/component/user_thumbnail/user_thumbnail.html.twig'
1113
parameters:

docs/templating/components.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ month_change: true
88
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.
99
They are combined into groups that are rendered in designated templates.
1010

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:
1212

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).
1417

1518
## Create Twig Component
1619

@@ -44,11 +47,12 @@ ibexa_twig_components:
4447
# Component name
4548
google_tag_manager:
4649
type: script
50+
priority: 50
4751
arguments:
4852
src: 'https://...'
4953
```
5054

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

5357
You can use an unique group name when creating a Twig Component to create your own group.
5458

docs/templating/layout/customize_storefront_layout.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ To customize your shop, you can override either whole templates, or specific com
1111
The built-in templates belong to the `storefront` [theme](design_engine.md).
1212
To override any of them, copy its directory structure in your template directory.
1313

14+
## Customize with Twig Components
15+
16+
You can customize parts of the storefront by using [Twig components](components.md).
17+
It allows you to inject your own widgets, extending the storefront behavior.
18+
19+
The available groups for the storefront are:
20+
21+
| Group name | Template file |
22+
|---|---|
23+
| `storefront-before-maincart` | `vendor/ibexa/storefront/src/bundle/Resources/views/themes/storefront/cart/component/maincart/maincart.html.twig` |
24+
| `storefront-after-maincart` | `vendor/ibexa/storefront/src/bundle/Resources/views/themes/storefront/cart/component/maincart/maincart.html.twig` |
25+
| `storefront-before-minicart` | `vendor/ibexa/storefront/src/bundle/Resources/views/themes/storefront/cart/component/minicart/minicart.html.twig` |
26+
| `storefront-after-minicart` | `vendor/ibexa/storefront/src/bundle/Resources/views/themes/storefront/cart/component/minicart/minicart.html.twig` |
27+
| `storefront-before-add-to-cart` | `vendor/ibexa/storefront/src/bundle/Resources/views/themes/storefront/cart/component/add_to_cart/add_to_cart.html.twig` |
28+
| `storefront-after-add-to-cart` | `vendor/ibexa/storefront/src/bundle/Resources/views/themes/storefront/cart/component/add_to_cart/add_to_cart.html.twig` |
29+
| `storefront-before-summary` | `vendor/ibexa/storefront/src/bundle/Resources/views/themes/storefront/cart/component/summary/summary.html.twig` |
30+
| `storefront-after-summary` | `vendor/ibexa/storefront/src/bundle/Resources/views/themes/storefront/cart/component/summary/summary.html.twig` |
31+
1432
## Template customization example
1533

1634
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

Comments
 (0)