Theme Customizer: Only show uploader 'remove' links when there is an image to remove. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5443bec597
commit
c6ae8b8e51
|
@ -398,13 +398,15 @@ class WP_Customize_Setting {
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
case 'upload':
|
case 'upload':
|
||||||
|
$value = $this->value();
|
||||||
|
$style = empty( $value ) ? 'style="display:none;"' : '';
|
||||||
?>
|
?>
|
||||||
<label>
|
<label>
|
||||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||||
<div>
|
<div>
|
||||||
<input type="hidden" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->name(); ?> />
|
<input type="hidden" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->name(); ?> />
|
||||||
<a href="#" class="button-secondary upload"><?php _e( 'Upload' ); ?></a>
|
<a href="#" class="button-secondary upload"><?php _e( 'Upload' ); ?></a>
|
||||||
<a href="#" class="remove"><?php _e( 'Remove' ); ?></a>
|
<a href="#" class="remove" <?php echo $style; ?>><?php _e( 'Remove' ); ?></a>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -83,10 +83,16 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.container.on( 'click', '.remove', function( event ) {
|
this.remover = this.container.find('.remove');
|
||||||
|
this.remover.click( function( event ) {
|
||||||
control.set('');
|
control.set('');
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.bind( this.removerVisibility );
|
||||||
|
},
|
||||||
|
removerVisibility: function( on ) {
|
||||||
|
this.remover.toggle( !! on );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue