[wp-trac] [WordPress Trac] #47692: Optgroup in Customizer Select Control

WordPress Trac noreply at wordpress.org
Wed May 20 11:29:42 UTC 2020


#47692: Optgroup in Customizer Select Control
-------------------------+-----------------------------
 Reporter:  chintan1896  |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Customize    |     Version:  3.4
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:
-------------------------+-----------------------------

Comment (by chintan1896):

 I have code in JavaScript template. But i am confused how to test my code
 working properly or not?

 Below file code - wp-includes/class-wp-customize-manager.php

 {{{#!php
 <?php
 <select
      <# _.each( _.extend( inputAttrs ), function( value, key ) { #>
                                                                 {{{ key
 }}}="{{ value }}"
         <# }); #>
         >
         <# _.each( data.choices, function( val, data ) { #>
                 <# var value, text;
                 if ( _.isObject( val ) ) {
                         value = val.value;
                         text = val.text;
                 } else {
                         value = data;
                         text = val;
                 }
                 if ( _.isArray( value ) && ! _.isEmpty( value ) ) {
                         #>
                                 <optgroup label="{{ value }}">
                                         <# _.each( value, function(
 optgroup_val, optgroup_data ) { #>
                                                 <option value="{{
 optgroup_val }}">{{ optgroup_data }}</option>
                                         <# } #>
                                 </optgroup>
                         <#
                 } else {
                 #>
                         <option value="{{ value }}">{{ text }}</option>
                 <#
                 }
                 #>
         <# } ); #>
 </select>
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47692#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list