ImageAsset Field Type¶
ImageAsset 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.
Input expectations¶
Example array:
Type | Description | Example |
---|---|---|
Ibexa\Core\FieldType\ImageAsset\Value |
ImageAsset 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 ezimageasset
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 will initialize 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:
destinationContentId
points 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.