When you define an image upload as a top-level input for a custom component (e.g.):
{
name: 'image'
type: 'file',
allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg', 'webp', 'gif'],
}
the consuming frontned componet will automatically receive an altText
prop, if the image has alt text defined on it in the asset library.
However, when an image upload for a custom component is declared as a subFields
item on a type: 'object'
input (e.g.):
{
name: 'card'
type: 'object',
subFields: [
{
name: 'title',
type: 'string'
},
{
name: 'image',
type: 'file',
allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg', 'webp', 'gif'],
},
],
}
then suddenly the altText
for the associated image file in the asset library is not passed to the frontend component; all that gets passed is the url of the asset as a string.
How then do we retrieve the altText
for image files declared as a subFields
item?