Skip to content

Commit 3e2953b

Browse files
committed
Extracted Twig rendering to separate files
1 parent 3b8815c commit 3e2953b

4 files changed

Lines changed: 21 additions & 19 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

docs/templating/twig_function_reference/image_twig_functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ page_type: reference
1313
To render images, use the [`ibexa_render_field()`](field_twig_functions.md#ibexa_render_field) Twig function with the variation name passed as an argument, for example:
1414

1515
``` html+twig
16-
[[= include_code('docs/templating/twig_function_reference/field_twig_functions.md', 42, 48) =]]
16+
[[= include_code('code_samples/templates/field_twig_functions/render_content.html.twig', 3, 9, remove_indent=True) =]]
1717
```
1818

1919
## Image information

0 commit comments

Comments
 (0)