Customize: Prevent using default template for a base control when it has content rendered on the server.
Also prevent invalid `type` attribute from being added to a `select` element. See #30738. Fixes #42286. git-svn-id: https://develop.svn.wordpress.org/trunk@41952 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d204ba3c00
commit
620eb3052c
|
@ -3897,8 +3897,12 @@
|
||||||
|
|
||||||
templateId = control.templateSelector;
|
templateId = control.templateSelector;
|
||||||
|
|
||||||
// Use default content template when a standard HTML type is used and there isn't a more specific template existing.
|
// Use default content template when a standard HTML type is used, there isn't a more specific template existing, and the control container is empty.
|
||||||
if ( templateId === 'customize-control-' + control.params.type + '-content' && _.contains( standardTypes, control.params.type ) && ! document.getElementById( 'tmpl-' + templateId ) ) {
|
if ( templateId === 'customize-control-' + control.params.type + '-content' &&
|
||||||
|
_.contains( standardTypes, control.params.type ) &&
|
||||||
|
! document.getElementById( 'tmpl-' + templateId ) &&
|
||||||
|
0 === control.container.children().length )
|
||||||
|
{
|
||||||
templateId = 'customize-control-default-content';
|
templateId = 'customize-control-default-content';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4019,6 +4019,7 @@ final class WP_Customize_Manager {
|
||||||
<# }); #>
|
<# }); #>
|
||||||
>{{ inputAttrs.value }}</textarea>
|
>{{ inputAttrs.value }}</textarea>
|
||||||
<# } else if ( 'select' === data.type ) { #>
|
<# } else if ( 'select' === data.type ) { #>
|
||||||
|
<# delete inputAttrs.type; #>
|
||||||
<select
|
<select
|
||||||
<# _.each( _.extend( inputAttrs ), function( value, key ) { #>
|
<# _.each( _.extend( inputAttrs ), function( value, key ) { #>
|
||||||
{{{ key }}}="{{ value }}"
|
{{{ key }}}="{{ value }}"
|
||||||
|
|
Loading…
Reference in New Issue