Description
We've set a custom field for all assets on a craft 5 installation, which works well as long as the custom field is the native plain-text field from craft. But as soon as the custom field is set as ckeditor field, it is not accessible anymore on the frontend via twig functions. Is this out of reach for the ckeditor plugin, or should it be accessible?
In more detail, we have created a custom field with name "caption" (to be used additionally to the native alt-field). when set to plain text, outputting it works well by using {{ image.caption }} (after the needed image-query) – but as soon as the field is a ckeditor-field it's an empty output.
Steps to reproduce
- create new custom field for assets, as described on https://craftcms.com/docs/5.x/reference/element-types/assets.html#asset-custom-fields
- add contents to the custom field on an example entry with assets
- try to output the custom field in the frontend with twig code
{{ image.caption }}
- other way that have been tried:
{{ image.caption.getContent() }} or {{ image.getFieldLayout().getCustomFields()|map(field => field.handle == 'caption' ? field.getContent() : null)|first }} which all result in errors cause image.caption is empty for ckeditor fields.
Additional info
- Craft version: 5.5.10
- PHP version: 8.2.27
- Plugins & versions: CKEditor 4.4.0
Description
We've set a custom field for all assets on a craft 5 installation, which works well as long as the custom field is the native plain-text field from craft. But as soon as the custom field is set as ckeditor field, it is not accessible anymore on the frontend via twig functions. Is this out of reach for the ckeditor plugin, or should it be accessible?
In more detail, we have created a custom field with name "caption" (to be used additionally to the native alt-field). when set to plain text, outputting it works well by using
{{ image.caption }}(after the needed image-query) – but as soon as the field is a ckeditor-field it's an empty output.Steps to reproduce
{{ image.caption }}{{ image.caption.getContent() }}or{{ image.getFieldLayout().getCustomFields()|map(field => field.handle == 'caption' ? field.getContent() : null)|first }}which all result in errors cause image.caption is empty for ckeditor fields.Additional info