[wp-trac] [WordPress Trac] #44641: Customizing Button Text in Custom Media Manager Frame Doesn't Work Anymore

WordPress Trac noreply at wordpress.org
Thu Jul 26 13:48:58 UTC 2018


#44641: Customizing Button Text in Custom Media Manager Frame Doesn't Work Anymore
--------------------------+------------------------------
 Reporter:  Kelderic      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  4.9.7
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by Kelderic):

 I've found a workaround, btw. Before triggering the frame.open() function,
 I can set my own value into `wp.media.view.l10n.insertIntoPost`. Then
 reset that value after I open the frame.


 {{{
 // CUSTOMIZE THE MAIN BUTTON TEXT

 var originalInsertIntoPost = wp.media.view.l10n.insertIntoPost;

 wp.media.view.l10n.insertIntoPost = 'Select Icon';

 // OPEN THE MODAL

 frame.open();

 // RESET THE MAIN BUTTON TEXT

 wp.media.view.l10n.insertIntoPost = originalInsertIntoPost;
 }}}

 This works and doesn't affect any other frames, but it seems hacky.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44641#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list