Changeset 30849
- Timestamp:
- 12/14/2014 07:36:27 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/customize-controls.css
r30737 r30849 606 606 607 607 .customize-control-upload .remove-button, 608 .customize-control-upload .default-button, 608 609 .customize-control-upload .upload-button, 609 610 .customize-control-image .remove-button, 611 .customize-control-image .default-button, 610 612 .customize-control-image .upload-button, 611 613 .customize-control-header button.new, … … 798 800 } 799 801 800 .customize-control-upload .remove-button 801 .customize-control-image .remove-button 802 .customize-control-upload .remove-button, 803 .customize-control-upload .default-button, 804 .customize-control-image .remove-button, 805 .customize-control-image .default-button, 802 806 .customize-control-header .remove { 803 807 float: left; -
trunk/src/wp-includes/class-wp-customize-control.php
r30847 r30849 688 688 $this->json['button_labels'] = $this->button_labels; 689 689 690 $value = $this->value(); 691 690 692 if ( is_object( $this->setting ) ) { 691 693 if ( $this->setting->default ) { … … 696 698 'url' => $this->setting->default, 697 699 'type' => $type, 698 'sizes' => array(699 'full' => array( 'url' => $this->setting->default ),700 ),701 700 'icon' => wp_mime_type_icon( $type ), 702 701 'title' => basename( $this->setting->default ), 703 702 ); 703 704 if ( 'image' === $type ) { 705 $default_attachment['sizes'] = array( 706 'full' => array( 'url' => $this->setting->default ), 707 ); 708 } 709 704 710 $this->json['defaultAttachment'] = $default_attachment; 705 711 } 706 712 707 // Get the attachment model for the existing file. 708 if ( $this->value() ) { 709 $attachment_id = attachment_url_to_postid( $this->value() ); 713 if ( $value && $this->setting->default && $value === $this->setting->default ) { 714 // Set the default as the attachment. 715 $this->json['attachment'] = $this->json['defaultAttachment']; 716 } elseif ( $value ) { 717 // Get the attachment model for the existing file. 718 $attachment_id = attachment_url_to_postid( $value ); 710 719 if ( $attachment_id ) { 711 $this->json['attachment'] = wp_prepare_attachment_for_js( $attachment_id );720 $this->json['attachment'] = wp_prepare_attachment_for_js( $attachment_id ); 712 721 } 713 } else if ( $this->setting->default ) {714 // Set the default as the attachment.715 $this->json['attachment'] = $default_attachment;716 722 } 717 723 } … … 742 748 </label> 743 749 744 <# // Ensure that the default attachment is used if it exists. 745 if ( _.isEmpty( data.attachment ) && data.defaultAttachment ) { 746 data.attachment = data.defaultAttachment; 747 } 748 749 if ( data.attachment && data.attachment.id ) { #> 750 <# if ( data.attachment && data.attachment.id ) { #> 750 751 <div class="current"> 751 752 <div class="container"> … … 774 775 </div> 775 776 <div class="actions"> 776 <# if ( data.defaultAttachment && data.defaultAttachment.id !== data.attachment.id ) { #> 777 <button type="button" class="button default-button remove-button"><?php echo $this->button_labels['default']; ?></button> 778 <# } else if ( ! data.defaultAttachment ) { #> 779 <button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button> 780 <# } #> 777 <button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button> 781 778 <button type="button" class="button upload-button" id="{{ data.settings.default }}-button"><?php echo $this->button_labels['change']; ?></button> 782 779 <div style="clear:both"></div> … … 796 793 <div class="actions"> 797 794 <# if ( data.defaultAttachment ) { #> 798 <button type="button" class="button default-button remove-button"><?php echo $this->button_labels['default']; ?></button>795 <button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button> 799 796 <# } #> 800 797 <button type="button" class="button upload-button" id="{{ data.settings.default }}-button"><?php echo $this->button_labels['select']; ?></button>
Note: See TracChangeset
for help on using the changeset viewer.