If I use Media Library to insert an image into a text area, the image's caption is empty and hidden.

Instead I want the caption displayed by default, pre-filled with text in the format: [Image entity name], by [username], eg '1960s street scene, by David'

(I'm migrating a site that uses D7 + the Scald module to D9 + core Media, and I want to replicate the old site's behaviour in the new site.)

Is there any way to customise Media Library's behaviour to do this?

If there isn't, then in D7 I'd ask for a new hook that will let me change what gets written into the text area when the user inserts an image. Is that still the right approach in D9?

1 Answer 1


I found a solution, and have written it up at: https://www.drupal.org/project/drupal/issues/3225834#comment-14341085

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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