Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access ckeditor custom fields when set on assets #355

Open
mindshaped opened this issue Jan 22, 2025 · 0 comments
Open

Unable to access ckeditor custom fields when set on assets #355

mindshaped opened this issue Jan 22, 2025 · 0 comments
Labels

Comments

@mindshaped
Copy link

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

  1. create new custom field for assets, as described on https://craftcms.com/docs/5.x/reference/element-types/assets.html#asset-custom-fields
  2. add contents to the custom field on an example entry with assets
  3. try to output the custom field in the frontend with twig code {{ image.caption }}
  4. 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
@mindshaped mindshaped added the bug label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant