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. git-svn-id: https://develop.svn.wordpress.org/trunk@36769 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
92dbe29078
commit
f60e7fd99d
@ -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' ),
|
||||
);
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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 {
|
||||
</div>
|
||||
<div class="actions">
|
||||
<# if ( data.canUpload ) { #>
|
||||
<button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button>
|
||||
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button>
|
||||
<button type="button" class="button remove-button">{{ data.button_labels.remove }}</button>
|
||||
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button">{{ data.button_labels.change }}</button>
|
||||
<div style="clear:both"></div>
|
||||
<# } #>
|
||||
</div>
|
||||
@ -204,7 +206,7 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
|
||||
<div class="placeholder">
|
||||
<div class="inner">
|
||||
<span>
|
||||
<?php echo $this->button_labels['placeholder']; ?>
|
||||
{{ data.button_labels.placeholder }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -212,10 +214,10 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
|
||||
</div>
|
||||
<div class="actions">
|
||||
<# if ( data.defaultAttachment ) { #>
|
||||
<button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
|
||||
<button type="button" class="button default-button">{{ data.button_labels.default }}</button>
|
||||
<# } #>
|
||||
<# if ( data.canUpload ) { #>
|
||||
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button>
|
||||
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button">{{ data.button_labels.select }}</button>
|
||||
<# } #>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user