[wp-trac] [WordPress Trac] #30737: JS templates for Customizer Panels and Sections

WordPress Trac noreply at wordpress.org
Sat May 30 00:12:38 UTC 2015


#30737: JS templates for Customizer Panels and Sections
------------------------------+--------------------------
 Reporter:  celloexpressions  |       Owner:  westonruter
     Type:  enhancement       |      Status:  accepted
 Priority:  normal            |   Milestone:  4.3
Component:  Customize         |     Version:  4.1
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |     Focuses:
------------------------------+--------------------------

Comment (by westonruter):

 Only two things remain before closing this out:

 1) Address the [https://core.trac.wordpress.org/ticket/30737#comment:36
 question I've raised] regarding falling back to the templates for
 `default` types.

 2) Provide a set of default params when constructing new `Section` and
 `Panel` objects (and even Controls). As
 [https://wordpress.slack.com/archives/core-customize/p1432942427001811
 discussed in Slack], if you fail to supply a `param.type`, then it will
 not even fall back to the `default` template, but will try to use a
 `undefined` template, which is even worse. So something like this would be
 good, to go along with my suggestion above.

 {{{#!diff
 --- src/wp-admin/js/customize-controls.js
 +++ src/wp-admin/js/customize-controls.js
 @@ -167,8 +167,16 @@
                 initialize: function ( id, options ) {
                         var container = this;
                         container.id = id;
 -                       container.params = {};
 -                       $.extend( container, options || {} );
 +                       options = options || {};
 +                       options.params = $.extend(
 +                               {
 +                                       'type': 'default',
 +                                       customizeAction:
 api.l10n.defaultSectionCustomizeAction
 +                                       // ...
 +                               },
 +                               options.params || {}
 +                       );
 +                       $.extend( container, options );
                         container.templateSelector = 'customize-' +
 container.containerType + '-' + container.params.type;
                         container.container = $( container.params.content
 );
                         if ( 0 === container.container.length ) {
 }}}

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


More information about the wp-trac mailing list