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.

Mohit Prajapati
  • 291
  • 1
  • 7

1 Answers1

6

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.

Matt Wilcox
  • 3,199
  • 1
  • 14
  • 28