I defined a custom entity type with an image base field. Now I want to have a default image which seems to be quite tricky: when I define a default image on a field api field and export the configs I can see that the file id of the image is set. But when I create a custom entity I cannot know which file id an image might have - except when I just create the image file on the time the entity type is created/ updated.

Is there a proper way to define a default image within the base field definition of a custom entity?

  • I don't know if this is a good idea to make a dependency on content, but you can create the content in an install hook and then update the fid in a basefield alter hook. – 4k4 Jul 17 at 12:40

Your Answer

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

Browse other questions tagged or ask your own question.