From 0e5bb06cb80ec4fe88f008de04445c2d0587ff8a Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 29 Feb 2016 00:40:26 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@36769 git-svn-id: http://core.svn.wordpress.org/trunk@36736 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../class-wp-customize-image-control.php | 4 +-- .../class-wp-customize-media-control.php | 30 ++++++++++--------- wp-includes/version.php | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/wp-includes/customize/class-wp-customize-image-control.php b/wp-includes/customize/class-wp-customize-image-control.php index dc50a3a115..ffb89e3f4a 100644 --- a/wp-includes/customize/class-wp-customize-image-control.php +++ b/wp-includes/customize/class-wp-customize-image-control.php @@ -31,7 +31,7 @@ class WP_Customize_Image_Control extends WP_Customize_Upload_Control { public function __construct( $manager, $id, $args = array() ) { parent::__construct( $manager, $id, $args ); - $this->button_labels = array( + $this->button_labels = wp_parse_args( $this->button_labels, array( 'select' => __( 'Select Image' ), 'change' => __( 'Change Image' ), 'remove' => __( 'Remove' ), @@ -39,7 +39,7 @@ class WP_Customize_Image_Control extends WP_Customize_Upload_Control { 'placeholder' => __( 'No image selected' ), 'frame_title' => __( 'Select Image' ), 'frame_button' => __( 'Choose Image' ), - ); + ) ); } /** diff --git a/wp-includes/customize/class-wp-customize-media-control.php b/wp-includes/customize/class-wp-customize-media-control.php index c99fd986f2..bcd8db8a63 100644 --- a/wp-includes/customize/class-wp-customize-media-control.php +++ b/wp-includes/customize/class-wp-customize-media-control.php @@ -55,15 +55,17 @@ class WP_Customize_Media_Control extends WP_Customize_Control { public function __construct( $manager, $id, $args = array() ) { parent::__construct( $manager, $id, $args ); - $this->button_labels = array( - 'select' => __( 'Select File' ), - 'change' => __( 'Change File' ), - 'default' => __( 'Default' ), - 'remove' => __( 'Remove' ), - 'placeholder' => __( 'No file selected' ), - 'frame_title' => __( 'Select File' ), - 'frame_button' => __( 'Choose File' ), - ); + if ( ! ( $this instanceof WP_Customize_Image_Control ) ) { + $this->button_labels = wp_parse_args( $this->button_labels, array( + 'select' => __( 'Select File' ), + 'change' => __( 'Change File' ), + 'default' => __( 'Default' ), + 'remove' => __( 'Remove' ), + 'placeholder' => __( 'No file selected' ), + 'frame_title' => __( 'Select File' ), + 'frame_button' => __( 'Choose File' ), + ) ); + } } /** @@ -193,8 +195,8 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
<# if ( data.canUpload ) { #> - - + +
<# } #>
@@ -204,7 +206,7 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
- button_labels['placeholder']; ?> + {{ data.button_labels.placeholder }}
@@ -212,10 +214,10 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
<# if ( data.defaultAttachment ) { #> - + <# } #> <# if ( data.canUpload ) { #> - + <# } #>
diff --git a/wp-includes/version.php b/wp-includes/version.php index 138c091df0..985c7d0591 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-beta1-36768'; +$wp_version = '4.5-beta1-36769'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.