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
Copy file name to clipboardExpand all lines: docs/templating/twig_function_reference/content_twig_functions.md
+22-5Lines changed: 22 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ You can provide `ibexa_render()` with either a content item or a Location object
28
28
29
29
|Argument|Type|Description|
30
30
|------|------|------|
31
-
|`content`</br>or</br>`location`|`Ibexa\Contracts\Core\Repository\Values\Content\Content`</br>or</br>`Ibexa\Contracts\Core\Repository\Values\Content\Location`|Content item or its location.|
31
+
|`content` or `location`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) or [`Location`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Location.html)|Content item or its location.|
32
32
|`method`|`string`|(optional) [Rendering method](#rendering-methods). One of: `direct`, `inline`, `esi`, `ssi`. (Default method is `direct`)|
33
33
|`viewType`|`string`|(optional) [View type](template_configuration.md#view-types). (Default view type is `embed`)|
34
34
@@ -60,7 +60,7 @@ If the content item doesn't have a translation in the prioritized or passed lang
60
60
61
61
| Argument | Type | Description |
62
62
|---------------|------|-------------|
63
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content`</br>or</br>`Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo`| Content item or its ContentInfo object.|
63
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html), [`ContentInfo`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html), or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item, its ContentInfo object, or ContentAwareInterface object.|
64
64
|`forcedLanguage`|`string`| (optional) Language to use (for example, `fre-FR`). |
65
65
66
66
```html+twig
@@ -69,30 +69,44 @@ If the content item doesn't have a translation in the prioritized or passed lang
69
69
{{ ibexa_content_name(content, 'pol-PL') }}
70
70
```
71
71
72
+
```html+twig
73
+
{{ ibexa_content_name(product) }}
74
+
75
+
{{ ibexa_content_name(product, 'fr-FR') }}
76
+
```
77
+
72
78
### `ibexa_seo_is_empty()`
73
79
74
80
`ibexa_seo_is_empty()` returns a Boolean value which indicates whether [SEO]([[= user_doc =]]/search_engine_optimization/seo/) data is available for the content item that is passed as an argument.
75
81
76
82
| Argument | Type | Description |
77
83
|---------------|------|-------------|
78
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content`</br>or</br>`Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo`| Content item or its ContentInfo object.|
84
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item or ContentAwareInterface object.|
79
85
80
86
```html+twig
81
87
{{ ibexa_seo_is_empty(content) }}
82
88
```
83
89
90
+
```html+twig
91
+
{{ ibexa_seo_is_empty(product) }}
92
+
```
93
+
84
94
### `ibexa_seo()`
85
95
86
96
`ibexa_seo()` attaches [SEO]([[= user_doc =]]/search_engine_optimization/seo/) data to the content item's HTML code.
87
97
88
98
| Argument | Type | Description |
89
99
|---------------|------|-------------|
90
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content`</br>or</br>`Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo`| Content item or its ContentInfo object.|
100
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item or ContentAwareInterface object.|
91
101
92
102
```html+twig
93
103
{{ ibexa_seo(content) }}
94
104
```
95
105
106
+
```html+twig
107
+
{{ ibexa_seo(product) }}
108
+
```
109
+
96
110
!!! tip
97
111
98
112
The following example uses both SEO-related functions:
@@ -112,12 +126,15 @@ If the content item doesn't have a translation in the prioritized or passed lang
112
126
113
127
| Argument | Type | Description |
114
128
|---------------|------|-------------|
115
-
|`content`|[`Ibexa\Contracts\Core\Repository\Values\Content\Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html)| Content item to display the category name for. |
129
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item to display the category name for. |
Copy file name to clipboardExpand all lines: docs/templating/twig_function_reference/field_twig_functions.md
+55-7Lines changed: 55 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ The field is rendered with the default template, but you can optionally pass a d
32
32
33
33
| Argument | Type | Description |
34
34
| ------ | ----- | ----- |
35
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content`| Content item the field belongs to. |
35
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item the field belongs to. |
36
36
|`fieldDefinitionIdentifier`|`string`| Field identifier. |
37
37
|`params`|`hash`| (optional) Hash of parameters passed to the template block. |
38
38
@@ -48,6 +48,18 @@ The field is rendered with the default template, but you can optionally pass a d
You can pass the following parameters to `ibexa_render_field()`:
@@ -80,14 +92,18 @@ If the content item doesn't have a translation in the prioritized or passed lang
80
92
81
93
| Argument | Type | Description |
82
94
|-----|------|-----|
83
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content`| Content item the field belongs to.|
95
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item the field belongs to.|
84
96
|`fieldDefIdentifier`|`string`| Identifier of the field. |
85
97
|`forcedLanguage`|`string`| (optional) Language to use (for example, "fre-FR"). |
86
98
87
99
```html+twig
88
100
{{ ibexa_field_value(content, 'image') }}
89
101
```
90
102
103
+
```html+twig
104
+
{{ ibexa_field_value(product, 'image') }}
105
+
```
106
+
91
107
### `ibexa_field()`
92
108
93
109
`ibexa_field()` returns the field object.
@@ -96,7 +112,7 @@ If the content item doesn't have a translation in the prioritized or passed lang
96
112
97
113
| Argument | Type | Description |
98
114
|-------|------|------|
99
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content`| Content item the field belongs to.|
115
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item the field belongs to.|
100
116
|`fieldDefIdentifier`|`string`| Identifier of the field. |
101
117
|`forcedLanguage`|`string`| {optional) Language to use (for example, "fre-FR"). |
102
118
@@ -109,6 +125,10 @@ You can use `ibexa_field()` to access the field type identifier:
@@ -120,7 +140,7 @@ If the content item doesn't have a translation in the prioritized or passed lang
120
140
121
141
| Argument | Type | Description |
122
142
|---------------|------|-------------|
123
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content` or `Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo`| Content item the field belongs to. |
143
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html), [`ContentInfo`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html), or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item the field belongs to. |
124
144
|`fieldDefIdentifier`|`string`| Identifier of the field. |
125
145
|`forcedLanguage`|`string`| (optional) Language to use (for example, `fre-FR`). |
126
146
@@ -131,6 +151,12 @@ If the content item doesn't have a translation in the prioritized or passed lang
`ibexa_field_description()` returns the description of a content item's field.
@@ -140,7 +166,7 @@ If the content item doesn't have a translation in the prioritized or passed lang
140
166
141
167
| Argument | Type | Description |
142
168
|---------------|------|-------------|
143
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content` or `Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo`| Content item the field belongs to. |
169
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html), [`ContentInfo`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html), or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item the field belongs to. |
144
170
|`fieldDefIdentifier`|`string`| Identifier of the field. |
145
171
|`forcedLanguage`|`string`| (optional) Language to use (for example, `fre-FR`). |
146
172
@@ -150,20 +176,30 @@ If the content item doesn't have a translation in the prioritized or passed lang
`ibexa_field_is_empty()` returns Boolean information whether a given field of a content item is empty.
156
188
157
189
| Argument | Type | Description |
158
190
|---------------|------|-------------|
159
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content` or `Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo`| Content item the field belongs to. |
191
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item the field belongs to. |
160
192
|`fieldDefIdentifier`|`string`| Identifier of the field. |
161
193
|`forcedLanguage`|`string`| (optional) Language to use (for example, `fre-FR`). |
162
194
163
195
```html+twig
164
196
{{ ibexa_field_is_empty(content, 'title') }}
165
197
```
166
198
199
+
```html+twig
200
+
{{ ibexa_field_is_empty(product, 'name') }}
201
+
```
202
+
167
203
#### Examples
168
204
169
205
For example, use `ibexa_field_is_empty()` to check whether a field is empty or filled before rendering it:
@@ -174,6 +210,12 @@ For example, use `ibexa_field_is_empty()` to check whether a field is empty or f
174
210
{% endif %}
175
211
```
176
212
213
+
```html+twig
214
+
{% if not ibexa_field_is_empty(product, 'image') %}
215
+
{{ ibexa_render_field(product, 'image') }}
216
+
{% endif %}
217
+
```
218
+
177
219
### `ibexa_field_group_name()`
178
220
179
221
`ibexa_field_group_name()` returns a human-readable name of a field group.
@@ -193,11 +235,17 @@ For example, use `ibexa_field_is_empty()` to check whether a field is empty or f
193
235
194
236
| Argument | Type | Description |
195
237
|---------------|------|-------------|
196
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content`| Content item the field may belong to. |
238
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item the field may belong to. |
197
239
|`fieldDefIdentifier`|`string`| Identifier of the field. |
Copy file name to clipboardExpand all lines: docs/templating/twig_function_reference/image_twig_functions.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ page_type: reference
13
13
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:
@@ -48,12 +48,16 @@ To render images, use the [`ibexa_render_field()`](field_twig_functions.md#ibexa
48
48
49
49
| Argument | Type | Description |
50
50
| ------ |----- | ----- |
51
-
|`content`|`Ibexa\Contracts\Core\Repository\Values\Content\Content`| Content item to display the image for. |
51
+
|`content`|[`Content`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) or [`ContentAwareInterface`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentAwareInterface.html)| Content item to display the image for. |
52
52
53
53
```html+twig
54
54
{% set firstImage = ibexa_content_field_identifier_first_filled_image(content) %}
55
55
```
56
56
57
+
```html+twig
58
+
{% set firstImage = ibexa_content_field_identifier_first_filled_image(product) %}
59
+
```
60
+
57
61
#### Examples
58
62
59
63
You can use `ibexa_content_field_identifier_first_filled_image()` to find and render the first existing image in an article:
0 commit comments