[wp-trac] [WordPress Trac] #29071: Make it easier to include an instance of the Customizer outside of customize.php

WordPress Trac noreply at wordpress.org
Tue Oct 7 17:02:00 UTC 2014


#29071: Make it easier to include an instance of the Customizer outside of
customize.php
-------------------------+-----------------------------
 Reporter:  ericlewis    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Customize    |     Version:  3.4
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  administration
-------------------------+-----------------------------

Comment (by westonruter):

 Another idea, one which would make the Customizer even more reusable, even
 to allow multiple instances appearing on the same page: instead of adding
 a `wp.customize.init()`, which is kinda following a “singletony” paradigm,
 it would be interesting to explore if the Customizer was a function
 prototype that could be instantiated. For instance:

 {{{
 wp.customize = new wp.Customizer( window._wpCustomizeSettings );
 }}}

 A challenge here, of course, is that there is a lot of code that adds
 stuff to `wp.customize` as a global namespace. So it could be difficult to
 encapsulate the Customizer in this way. So something like this might need
 to be used instead:

 {{{
 wp.customize = $.extend( new wp.Customizer( window._wpCustomizeSettings ),
 wp.customize );
 }}}

 In this way, other instances of the Customizer could be created but
 assigned to other variables to live alongside any primary customizer. Any
 pieces of code that refer to `wp.customize` (i.e. `api`) would need to be
 updated to be explicitly passed a Customizer instance that they should be
 referring to.

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


More information about the wp-trac mailing list