Dear WordPress community,
I am wondering what is the suggested way to customize the template of the new gallery preview in editor?
I found out, that the current template is located in /wp-includes/media-template.php
in #tmpl-editor-gallery
block. So I can use the print_media_templates action hook to output my own editor gallery template, but how to switch from the default to that new template?
By digging a little bit into the associated JavaScript code I found out that executing the following JavaScript code in the right time (after wordpress code is loaded) works:
wp.mce.gallery.View = wp.mce.gallery.View.extend({ template: wp.media.template("my-editor-gallery") });
Please tell me, is that the best solution? Or is there something more elegant and more stable with respect to the future development?
Thank you a lot,
Jiri Hon