[wp-trac] [WordPress Trac] #35926: Allow controls to be registered without any associated settings

WordPress Trac noreply at wordpress.org
Tue Feb 23 20:48:41 UTC 2016


#35926: Allow controls to be registered without any associated settings
-------------------------+-------------------------
 Reporter:  westonruter  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  4.5
Component:  Customize    |    Version:  3.4
 Severity:  normal       |   Keywords:  needs-patch
  Focuses:               |
-------------------------+-------------------------
 Sometimes controls need to be added which don't directly have associated
 settings. For example, there can be controls needed which manipulate some
 aspect of the Customizer interface or manage the behavior of other
 controls and their settings (e.g. a control that contains a button to
 create a new setting). For example, nav menus in the Customizer have two
 settings `create_new_menu` and `new_menu_name` both of which have custom
 setting types to basically make them no-op settings that don't get
 persisted into the DB. The settings are being used here as hacks to get
 the controls to register properly. I know this has been done in other
 places as well as the current “state of the art”, like
 http://wordpress.stackexchange.com/a/212432/8521

 With the introduction of selective refresh (#27355), partials could
 technically be registered (though at the moment not via the constructor)
 that do not have any associated settings (and in their case, the
 `isRelatedSetting()` method in JS can be used to dynamically changed
 settings with a partial). Controls should also be able to be registered
 without related settings.

 Changes will be needed to the PHP `WP_Customize_Control` and to the
 corresponding JS `wp.customize.Control` to allow it to initialize properly
 with an empty settings array.

 Note that the `WP_Customize_Control` should then also have an intrinsic
 `capability` property since it wouldn't inherently derive its capability
 from its settings (if it has none). (And the same should be true for
 `WP_Customize_Partial`.)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35926>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list