Skip to content

Commit 6ddbf1b

Browse files
committed
Extracted Twig rendering to separate files
1 parent 528ed34 commit 6ddbf1b

3 files changed

Lines changed: 20 additions & 18 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{ ibexa_render_field(content, 'title') }}
2+
3+
{{ ibexa_render_field(content, 'image', {
4+
'template': '@ibexadesign/fields/image.html.twig',
5+
'attr': {class: 'thumbnail-image'},
6+
'parameters': {
7+
'alias': 'small'
8+
}
9+
}) }}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{ ibexa_render_field(product, 'name') }}
2+
3+
{{ ibexa_render_field(product, 'image', {
4+
'template': '@ibexadesign/fields/image.html.twig',
5+
'attr': {class: 'thumbnail-image'},
6+
'parameters': {
7+
'alias': 'small'
8+
}
9+
}) }}

docs/templating/twig_function_reference/field_twig_functions.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,11 @@ The field is rendered with the default template, but you can optionally pass a d
3636
| `params` | `hash` | (optional) Hash of parameters passed to the template block. |
3737

3838
``` html+twig
39-
{{ ibexa_render_field(content, 'title') }}
40-
41-
{{ ibexa_render_field(content, 'image', {
42-
'template': '@ibexadesign/fields/image.html.twig',
43-
'attr': {class: 'thumbnail-image'},
44-
'parameters': {
45-
'alias': 'small'
46-
}
47-
}) }}
39+
[[= include_code('code_samples/templates/field_twig_functions/render_content.html.twig') =]]
4840
```
4941

5042
``` html+twig
51-
{{ ibexa_render_field(product, 'name') }}
52-
53-
{{ ibexa_render_field(product, 'image', {
54-
'template': '@ibexadesign/fields/image.html.twig',
55-
'attr': {class: 'thumbnail-image'},
56-
'parameters': {
57-
'alias': 'small'
58-
}
59-
}) }}
43+
[[= include_code('code_samples/templates/field_twig_functions/render_product.html.twig') =]]
6044
```
6145

6246
#### Parameters

0 commit comments

Comments
 (0)