Ticket #30683: 30683.2.patch
File 30683.2.patch, 4.1 KB (added by , 10 years ago) |
---|
-
src/wp-admin/css/customize-controls.css
605 605 } 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, 612 614 .customize-control-header button.remove { … … 797 799 border-radius: 2px; 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; 804 808 margin-right: 3px; -
src/wp-includes/class-wp-customize-control.php
687 687 $this->json['mime_type'] = $this->mime_type; 688 688 $this->json['button_labels'] = $this->button_labels; 689 689 690 $current = $this->value(); 691 690 692 if ( is_object( $this->setting ) ) { 691 693 if ( $this->setting->default ) { 692 694 // Fake an attachment model - needs all fields used by template. … … 704 706 $this->json['defaultAttachment'] = $default_attachment; 705 707 } 706 708 707 // Get the attachment model for the existing file. 708 if ( $this->value() ) { 709 $attachment_id = attachment_url_to_postid( $this->value() ); 709 if ( $current && $this->setting->default && $current === $this->setting->default ) { 710 $this->json['attachment'] = $this->json['defaultAttachment']; 711 } elseif ( $current ) { 712 $attachment_id = attachment_url_to_postid( $current ); 710 713 if ( $attachment_id ) { 711 $this->json['attachment'] = wp_prepare_attachment_for_js( $attachment_id );714 $this->json['attachment'] = wp_prepare_attachment_for_js( $attachment_id ); 712 715 } 713 } else if ( $this->setting->default ) {714 // Set the default as the attachment.715 $this->json['attachment'] = $default_attachment;716 716 } 717 717 } 718 718 } … … 741 741 <# } #> 742 742 </label> 743 743 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 ) { #> 744 <# if ( data.attachment && data.attachment.id ) { #> 750 745 <div class="current"> 751 746 <div class="container"> 752 747 <div class="attachment-media-view attachment-media-view-{{ data.attachment.type }} {{ data.attachment.orientation }}"> … … 773 768 </div> 774 769 </div> 775 770 <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 <# } #> 771 <button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button> 781 772 <button type="button" class="button upload-button" id="{{ data.settings.default }}-button"><?php echo $this->button_labels['change']; ?></button> 782 773 <div style="clear:both"></div> 783 774 </div> … … 795 786 </div> 796 787 <div class="actions"> 797 788 <# if ( data.defaultAttachment ) { #> 798 <button type="button" class="button default-button remove-button"><?php echo $this->button_labels['default']; ?></button>789 <button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button> 799 790 <# } #> 800 791 <button type="button" class="button upload-button" id="{{ data.settings.default }}-button"><?php echo $this->button_labels['select']; ?></button> 801 792 <div style="clear:both"></div>