ImageAsset field type¶
Image Asset field type enables storing images in independent content items of a generic Image content type, in the media library. It makes them reusable across system.
| Name | Internal name | 
|---|---|
ImageAsset | 
ibexa_image_asset | 
Input expectations¶
Example array:
| Type | Description | Example | 
|---|---|---|
Ibexa\Core\FieldType\ImageAsset\Value | 
Image Asset field type value object. | See below. | 
Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo | 
ContentInfo instance of the Asset content item. | n/a | 
string | 
ID of the Asset content item. | "150" | 
integer | 
ID of the Asset content item. | 150 | 
Value object¶
Properties¶
Value object of ibexa_image_asset contains the following properties:
| Property | Type | Description | 
|---|---|---|
destinationContentId | 
int | 
Related content ID. | 
alternativeText | 
string | 
The alternative image text (for example "Picture of an apple."). | 
1 2 3 4  |  | 
Constructor¶
The ImageAsset\Value constructor initializes a new value object with the value provided.
It expects an ID of a content item representing asset and the alternative text.
1 2 3 4  |  | 
Validation¶
This field type validates if:
destinationContentIdpoints to a content item which has correct content type
Configuration¶
ImageAsset field type allows configuring the following options:
| Name | Description | Default value | 
|---|---|---|
content_type_identifier | 
Content type used to store assets. | image | 
content_field_identifier | 
Field identifier used for asset data. | image | 
name_field_identifier | 
Field identifier used for asset name. | name | 
parent_location_id | 
Location where the assets are created. | 51 | 
Example configuration:
1 2 3 4 5 6 7 8 9  |  | 
Customizing ImageAsset field type rendering¶
Internally, the Image Asset Type is rendered via subrequest (similar to other relation types).
Rendering customization is possible by configuring view type asset_image:
1 2 3 4 5 6 7 8  |  | 
Generating image variation from the Image Asset¶
Thanks to the Ibexa\Bundle\Core\Imagine\ImageAsset decorator you can work with Ibexa\Contracts\Core\Variation in the same way as with Image field type.