3

I have a field for upload an image in asset field. Can we set a default image in this field. Means when I create a new entry a default image has been already selected in asset field.

5

That's not possible, but the way I handle this is to have a Global called "Missing Image Fallback" inside a "Generic" Global field set, and then when I need to reference an image I use the following twig:

{% set image = entry.myImageField.first ?? generic.missingImageFallback.first %}

That will assign the first myImageField asset to 'image' if it's been filled in, but fall back to the generic global field if not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.