WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#35542 closed defect (bug) (fixed)

Media control don't allow button labels to be customized from the args array.

Reported by: chetanchauhan Owned by: westonruter
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.2
Component: Customize Keywords: has-patch
Focuses: Cc:

Description

The code below doesn't work.

<?php
$wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'media_test', array(
                'label' => __( 'Example Media (audio) Control' ),
                'section' => 'title_tagline',
                'mime_type' => 'audio',
                'button_labels' => array(
                        'select'       => __( 'Select Audio' ),
                        'change'       => __( 'Change Audio' ),
                        'default'      => __( 'Default' ),
                        'remove'       => __( 'Remove' ),
                        'placeholder'  => __( 'No file selected' ),
                        'frame_title'  => __( 'Select Audio' ),
                        'frame_button' => __( 'Choose Audio' ),
                ),
        ) ) );

Attachments (2)

35542.diff (2.4 KB) - added by chetanchauhan 2 years ago.
Allow media control button labels to be customized for each control seperately
35542.2.diff (3.6 KB) - added by celloexpressions 2 years ago.
Merge image control changes from #33755 with adjustment from ocean90.

Download all attachments as: .zip

Change History (9)

@chetanchauhan
2 years ago

Allow media control button labels to be customized for each control seperately

This ticket was mentioned in Slack in #core-customize by chetanchauhan. View the logs.


2 years ago

#2 @chetanchauhan
2 years ago

  • Keywords has-patch added

#3 @westonruter
2 years ago

  • Milestone changed from Awaiting Review to 4.5
  • Version changed from trunk to 4.2

#4 @westonruter
2 years ago

  • Owner set to celloexpressions
  • Status changed from new to reviewing

This has also been brought up by @celloexpressions at https://core.trac.wordpress.org/ticket/33755?replyto=102#comment:102

The button_labels parameter is supposed to be customizable, but I messed that up when I wrote the original WP_Customize_Media_Control and the new image control patches and I guess we never caught it. I added those to the control registration, so that element of the custom control is preserved (may not fully be working yet though - could use another set of eyes). This change is backwards compatible for subclasses that previously set button labels by overriding the whole array in a custom class constructor - that still works.

@celloexpressions
2 years ago

Merge image control changes from #33755 with adjustment from ocean90.

#5 @celloexpressions
2 years ago

Good find @chetanchauhan, I'm surprised no one noticed this sooner.

35542.2.diff merges in my version from #33755 and the change suggested by ocean90 with the initial patch. This should be ready to commit.

#6 @westonruter
2 years ago

  • Owner changed from celloexpressions to westonruter
  • Status changed from reviewing to accepted

#7 @westonruter
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 36769:

Customize: Allow button_labels to be overridden in $args passed to WP_Customize_Media_Control and WP_Customize_Image_Control.

Props chetanchauhan, celloexpressions.
See #33755.
Fixes #35542.

Note: See TracTickets for help on using tickets.