WordPress.org

Make WordPress Core

Changeset 20261


Ignore:
Timestamp:
03/22/12 07:30:44 (2 years ago)
Author:
koopersmith
Message:

Theme Customizer: Only show uploader 'remove' links when there is an image to remove. see #19910.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize-setting.php

    r20260 r20261  
    399399                break; 
    400400            case 'upload': 
     401                $value = $this->value(); 
     402                $style = empty( $value ) ? 'style="display:none;"' : ''; 
    401403                ?> 
    402404                <label> 
     
    405407                        <input type="hidden" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->name(); ?> /> 
    406408                        <a href="#" class="button-secondary upload"><?php _e( 'Upload' ); ?></a> 
    407                         <a href="#" class="remove"><?php _e( 'Remove' ); ?></a> 
     409                        <a href="#" class="remove" <?php echo $style; ?>><?php _e( 'Remove' ); ?></a> 
    408410                    </div> 
    409411                </label> 
  • trunk/wp-includes/js/customize-controls.dev.js

    r20260 r20261  
    8484            }); 
    8585 
    86             this.container.on( 'click', '.remove', function( event ) { 
     86            this.remover = this.container.find('.remove'); 
     87            this.remover.click( function( event ) { 
    8788                control.set(''); 
    8889                event.preventDefault(); 
    8990            }); 
     91 
     92            this.bind( this.removerVisibility ); 
     93        }, 
     94        removerVisibility: function( on ) { 
     95            this.remover.toggle( !! on ); 
    9096        } 
    9197    }); 
Note: See TracChangeset for help on using the changeset viewer.