--- a/wp/wp-includes/customize/class-wp-customize-media-control.php Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/customize/class-wp-customize-media-control.php Mon Oct 14 18:28:13 2019 +0200
@@ -75,10 +75,10 @@
*/
public function to_json() {
parent::to_json();
- $this->json['label'] = html_entity_decode( $this->label, ENT_QUOTES, get_bloginfo( 'charset' ) );
- $this->json['mime_type'] = $this->mime_type;
+ $this->json['label'] = html_entity_decode( $this->label, ENT_QUOTES, get_bloginfo( 'charset' ) );
+ $this->json['mime_type'] = $this->mime_type;
$this->json['button_labels'] = $this->button_labels;
- $this->json['canUpload'] = current_user_can( 'upload_files' );
+ $this->json['canUpload'] = current_user_can( 'upload_files' );
$value = $this->value();
@@ -86,13 +86,13 @@
if ( $this->setting->default ) {
// Fake an attachment model - needs all fields used by template.
// Note that the default value must be a URL, NOT an attachment ID.
- $type = in_array( substr( $this->setting->default, -3 ), array( 'jpg', 'png', 'gif', 'bmp' ) ) ? 'image' : 'document';
+ $type = in_array( substr( $this->setting->default, -3 ), array( 'jpg', 'png', 'gif', 'bmp' ) ) ? 'image' : 'document';
$default_attachment = array(
- 'id' => 1,
- 'url' => $this->setting->default,
- 'type' => $type,
- 'icon' => wp_mime_type_icon( $type ),
- 'title' => basename( $this->setting->default ),
+ 'id' => 1,
+ 'url' => $this->setting->default,
+ 'type' => $type,
+ 'icon' => wp_mime_type_icon( $type ),
+ 'title' => wp_basename( $this->setting->default ),
);
if ( 'image' === $type ) {
@@ -132,12 +132,11 @@
public function content_template() {
?>
<#
- var selectButtonId = _.uniqueId( 'customize-media-control-button-' );
var descriptionId = _.uniqueId( 'customize-media-control-description-' );
var describedByAttr = data.description ? ' aria-describedby="' + descriptionId + '" ' : '';
#>
<# if ( data.label ) { #>
- <label class="customize-control-title" for="{{ selectButtonId }}">{{ data.label }}</label>
+ <span class="customize-control-title">{{ data.label }}</span>
<# } #>
<div class="customize-control-notifications-container"></div>
<# if ( data.description ) { #>
@@ -182,22 +181,19 @@
<div class="actions">
<# if ( data.canUpload ) { #>
<button type="button" class="button remove-button">{{ data.button_labels.remove }}</button>
- <button type="button" class="button upload-button control-focus" id="{{ selectButtonId }}" {{{ describedByAttr }}}>{{ data.button_labels.change }}</button>
+ <button type="button" class="button upload-button control-focus" {{{ describedByAttr }}}>{{ data.button_labels.change }}</button>
<# } #>
</div>
</div>
<# } else { #>
<div class="attachment-media-view">
- <div class="placeholder">
- {{ data.button_labels.placeholder }}
- </div>
+ <# if ( data.canUpload ) { #>
+ <button type="button" class="upload-button button-add-media" {{{ describedByAttr }}}>{{ data.button_labels.select }}</button>
+ <# } #>
<div class="actions">
<# if ( data.defaultAttachment ) { #>
<button type="button" class="button default-button">{{ data.button_labels['default'] }}</button>
<# } #>
- <# if ( data.canUpload ) { #>
- <button type="button" class="button upload-button" id="{{ selectButtonId }}" {{{ describedByAttr }}}>{{ data.button_labels.select }}</button>
- <# } #>
</div>
</div>
<# } #>
@@ -241,6 +237,7 @@
case 'image':
return array(
'select' => __( 'Select image' ),
+ 'site_icon' => __( 'Select site icon' ),
'change' => __( 'Change image' ),
'default' => __( 'Default' ),
'remove' => __( 'Remove' ),