[wp-trac] [WordPress Trac] #28709: Improve/introduce Customizer models for Controls, Sections, and Panels
WordPress Trac
noreply at wordpress.org
Wed Jul 2 03:56:49 UTC 2014
#28709: Improve/introduce Customizer models for Controls, Sections, and Panels
-------------------------+----------------------------
Reporter: westonruter | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Customize | Version:
Severity: normal | Keywords: needs-patch
Focuses: javascript |
-------------------------+----------------------------
The Customizer currently has a `Control` model which facilitates
interacting with a control that was registered in the initial request to
open the Customizer. As explored in the Widget Customizer (#27112),
controls may also be dynamically instantiated and destroyed via JavaScript
(see [https://github.com/x-team/wordpress-
develop/blob/9ab7f4b1448fee7ab62c764bccff923cdbc82ba8/src/wp-admin/js
/customize-widgets.js#L1618-L1650 customize-widgets.js]). However, the
current `Control` model was not specifically designed for this since the
constructor does not allow you to pass a template for the control to then
get added to a given section's container element automatically. Instead,
you're currently required to first construct the control's elements and
insert them into the page, and then create a new `Control` model instance
that connects to this element that was inserted into the document.
In addition to improving the `Control` model to facilitate dynamic
instantiation via JavaScript, there also need to be models for managing
Sections and (with #27406) Panels. Just as you can create controls
dynamically, you should be able to create sections and panels. The models
should allow the section/panel to have state for whether they are open or
closed, and they should have methods for expanding/collapsing. They also
should have collections which represent which controls a section has, and
which sections a panel has. There should likewise be methods for adding
controls to sections and adding methods to controls, and the DOM should
automatically update to move the container elements to their appropriate
locations when such changes are made.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28709>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list