Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions docs/templating/twig_function_reference/content_twig_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

|Argument|Type|Description|
|------|------|------|
|`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.|
|`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.|

Check failure on line 31 in docs/templating/twig_function_reference/content_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/content_twig_functions.md#L31

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/content_twig_functions.md", "range": {"start": {"line": 31, "column": 82}}}, "severity": "ERROR"}
|`method`|`string`|(optional) [Rendering method](#rendering-methods). One of: `direct`, `inline`, `esi`, `ssi`. (Default method is `direct`)|
|`viewType`|`string`|(optional) [View type](template_configuration.md#view-types). (Default view type is `embed`)|

Expand Down Expand Up @@ -60,7 +60,7 @@

| Argument | Type | Description |
|---------------|------|-------------|
| `content` | `Ibexa\Contracts\Core\Repository\Values\Content\Content`</br>or</br>`Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo` | Content item or its ContentInfo object.|
| `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.|

Check failure on line 63 in docs/templating/twig_function_reference/content_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/content_twig_functions.md#L63

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/content_twig_functions.md", "range": {"start": {"line": 63, "column": 71}}}, "severity": "ERROR"}
| `forcedLanguage` | `string` | (optional) Language to use (for example, `fre-FR`). |

``` html+twig
Expand All @@ -69,30 +69,44 @@
{{ ibexa_content_name(content, 'pol-PL') }}
```

``` html+twig
{{ ibexa_content_name(product) }}

{{ ibexa_content_name(product, 'fr-FR') }}
```

### `ibexa_seo_is_empty()`

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

| Argument | Type | Description |
|---------------|------|-------------|
| `content` | `Ibexa\Contracts\Core\Repository\Values\Content\Content`</br>or</br>`Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo` | Content item or its ContentInfo object.|
| `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.|

Check failure on line 84 in docs/templating/twig_function_reference/content_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/content_twig_functions.md#L84

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/content_twig_functions.md", "range": {"start": {"line": 84, "column": 71}}}, "severity": "ERROR"}

``` html+twig
{{ ibexa_seo_is_empty(content) }}
```

``` html+twig
{{ ibexa_seo_is_empty(product) }}
```

### `ibexa_seo()`

`ibexa_seo()` attaches [SEO]([[= user_doc =]]/search_engine_optimization/seo/) data to the content item's HTML code.

| Argument | Type | Description |
|---------------|------|-------------|
| `content` | `Ibexa\Contracts\Core\Repository\Values\Content\Content`</br>or</br>`Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo` | Content item or its ContentInfo object.|
| `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.|

Check failure on line 100 in docs/templating/twig_function_reference/content_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/content_twig_functions.md#L100

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/content_twig_functions.md", "range": {"start": {"line": 100, "column": 71}}}, "severity": "ERROR"}

``` html+twig
{{ ibexa_seo(content) }}
```

``` html+twig
{{ ibexa_seo(product) }}
```

!!! tip

The following example uses both SEO-related functions:
Expand All @@ -112,12 +126,15 @@

| Argument | Type | Description |
|---------------|------|-------------|
| `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. |
| `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. |

Check failure on line 129 in docs/templating/twig_function_reference/content_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/content_twig_functions.md#L129

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/content_twig_functions.md", "range": {"start": {"line": 129, "column": 71}}}, "severity": "ERROR"}

```html+twig
{{ content|ibexa_taxonomy_entries_for_content|map(entry => "#{entry.name}")|join(', ') }}
```

```html+twig
{{ product|ibexa_taxonomy_entries_for_content|map(entry => "#{entry.name}")|join(', ') }}
```

## Non-content related queries

Expand Down
62 changes: 55 additions & 7 deletions docs/templating/twig_function_reference/field_twig_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

| Argument | Type | Description |
| ------ | ----- | ----- |
| `content` | `Ibexa\Contracts\Core\Repository\Values\Content\Content` | Content item the field belongs to. |
| `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. |

Check failure on line 35 in docs/templating/twig_function_reference/field_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/field_twig_functions.md#L35

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/field_twig_functions.md", "range": {"start": {"line": 35, "column": 71}}}, "severity": "ERROR"}
| `fieldDefinitionIdentifier` | `string` | Field identifier. |
| `params` | `hash` | (optional) Hash of parameters passed to the template block. |

Expand All @@ -48,6 +48,18 @@
}) }}
```

``` html+twig
{{ ibexa_render_field(product, 'name') }}

{{ ibexa_render_field(product, 'image', {
'template': '@ibexadesign/fields/image.html.twig',
'attr': {class: 'thumbnail-image'},
'parameters': {
'alias': 'small'
}
}) }}
```

#### Parameters

You can pass the following parameters to `ibexa_render_field()`:
Expand Down Expand Up @@ -80,14 +92,18 @@

| Argument | Type | Description |
|-----|------|-----|
| `content`| `Ibexa\Contracts\Core\Repository\Values\Content\Content` | Content item the field belongs to.|
| `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.|

Check failure on line 95 in docs/templating/twig_function_reference/field_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/field_twig_functions.md#L95

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/field_twig_functions.md", "range": {"start": {"line": 95, "column": 71}}}, "severity": "ERROR"}
| `fieldDefIdentifier` | `string` | Identifier of the field. |
| `forcedLanguage` | `string` | (optional) Language to use (for example, "fre-FR"). |

``` html+twig
{{ ibexa_field_value(content, 'image') }}
```

``` html+twig
{{ ibexa_field_value(product, 'image') }}
```

### `ibexa_field()`

`ibexa_field()` returns the field object.
Expand All @@ -96,7 +112,7 @@

| Argument | Type | Description |
|-------|------|------|
| `content`| `Ibexa\Contracts\Core\Repository\Values\Content\Content` | Content item the field belongs to.|
| `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.|

Check failure on line 115 in docs/templating/twig_function_reference/field_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/field_twig_functions.md#L115

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/field_twig_functions.md", "range": {"start": {"line": 115, "column": 71}}}, "severity": "ERROR"}
| `fieldDefIdentifier` | `string` | Identifier of the field. |
| `forcedLanguage` | `string` | {optional) Language to use (for example, "fre-FR"). |

Expand All @@ -109,6 +125,10 @@
{{ ibexa_field(content, 'my_field').fieldTypeIdentifier }}
```

``` html+twig
{{ ibexa_field(product, 'my_field').fieldTypeIdentifier }}
```

## Field information

### `ibexa_field_name()`
Expand All @@ -120,7 +140,7 @@

| Argument | Type | Description |
|---------------|------|-------------|
| `content` | `Ibexa\Contracts\Core\Repository\Values\Content\Content` or `Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo` | Content item the field belongs to. |
| `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. |

Check failure on line 143 in docs/templating/twig_function_reference/field_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/field_twig_functions.md#L143

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/field_twig_functions.md", "range": {"start": {"line": 143, "column": 71}}}, "severity": "ERROR"}
| `fieldDefIdentifier` | `string` | Identifier of the field. |
| `forcedLanguage` | `string` | (optional) Language to use (for example, `fre-FR`). |

Expand All @@ -131,6 +151,12 @@
{{ ibexa_field_name(content, 'title', 'ger-DE') }}
```

``` html+twig
{{ ibexa_field_name(product, 'name') }}

{{ ibexa_field_name(product, 'name', 'pl-PL') }}
```

### `ibexa_field_description()`

`ibexa_field_description()` returns the description of a content item's field.
Expand All @@ -140,7 +166,7 @@

| Argument | Type | Description |
|---------------|------|-------------|
| `content` | `Ibexa\Contracts\Core\Repository\Values\Content\Content` or `Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo` | Content item the field belongs to. |
| `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. |

Check failure on line 169 in docs/templating/twig_function_reference/field_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/field_twig_functions.md#L169

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/field_twig_functions.md", "range": {"start": {"line": 169, "column": 71}}}, "severity": "ERROR"}
| `fieldDefIdentifier` | `string` | Identifier of the field. |
| `forcedLanguage` | `string` | (optional) Language to use (for example, `fre-FR`). |

Expand All @@ -150,20 +176,30 @@
{{ ibexa_field_description(content, 'title', 'ger-DE') }}
```

``` html+twig
{{ ibexa_field_description(product, 'name') }}

{{ ibexa_field_description(product, 'name', 'fr-FR') }}
```

### `ibexa_field_is_empty()`

`ibexa_field_is_empty()` returns Boolean information whether a given field of a content item is empty.

| Argument | Type | Description |
|---------------|------|-------------|
| `content` | `Ibexa\Contracts\Core\Repository\Values\Content\Content` or `Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo` | Content item the field belongs to. |
| `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. |

Check failure on line 191 in docs/templating/twig_function_reference/field_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/field_twig_functions.md#L191

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/field_twig_functions.md", "range": {"start": {"line": 191, "column": 71}}}, "severity": "ERROR"}
| `fieldDefIdentifier` | `string` | Identifier of the field. |
| `forcedLanguage` | `string` | (optional) Language to use (for example, `fre-FR`). |

``` html+twig
{{ ibexa_field_is_empty(content, 'title') }}
```

``` html+twig
{{ ibexa_field_is_empty(product, 'name') }}
```

#### Examples

For example, use `ibexa_field_is_empty()` to check whether a field is empty or filled before rendering it:
Expand All @@ -174,6 +210,12 @@
{% endif %}
```

``` html+twig
{% if not ibexa_field_is_empty(product, 'image') %}
{{ ibexa_render_field(product, 'image') }}
{% endif %}
```

### `ibexa_field_group_name()`

`ibexa_field_group_name()` returns a human-readable name of a field group.
Expand All @@ -193,11 +235,17 @@

| Argument | Type | Description |
|---------------|------|-------------|
| `content` | `Ibexa\Contracts\Core\Repository\Values\Content\Content` | Content item the field may belong to. |
| `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. |

Check failure on line 238 in docs/templating/twig_function_reference/field_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/field_twig_functions.md#L238

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/field_twig_functions.md", "range": {"start": {"line": 238, "column": 71}}}, "severity": "ERROR"}
| `fieldDefIdentifier` | `string` | Identifier of the field. |

``` html+twig
{% if ibexa_has_field(content, 'existing') %}
{{ ibexa_render_field(content, 'existing') }}
{% endif %}
```

``` html+twig
{% if ibexa_has_field(product, 'existing') %}
{{ ibexa_render_field(product, 'existing') }}
{% endif %}
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
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:

``` html+twig
[[= include_file('docs/templating/twig_function_reference/field_twig_functions.md', 38, 45) =]]
[[= include_file('docs/templating/twig_function_reference/field_twig_functions.md', 40, 48) =]]
```

## Image information
Expand Down Expand Up @@ -48,12 +48,16 @@

| Argument | Type | Description |
| ------ |----- | ----- |
| `content` | `Ibexa\Contracts\Core\Repository\Values\Content\Content` | Content item to display the image for. |
| `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. |

Check failure on line 51 in docs/templating/twig_function_reference/image_twig_functions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/templating/twig_function_reference/image_twig_functions.md#L51

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/templating/twig_function_reference/image_twig_functions.md", "range": {"start": {"line": 51, "column": 71}}}, "severity": "ERROR"}

``` html+twig
{% set firstImage = ibexa_content_field_identifier_first_filled_image(content) %}
```

``` html+twig
{% set firstImage = ibexa_content_field_identifier_first_filled_image(product) %}
```

#### Examples

You can use `ibexa_content_field_identifier_first_filled_image()` to find and render the first existing image in an article:
Expand Down
Loading