A first non working approach to the Backbone side of things.
In my earlier post I’ve explained that the multi image Theme Customizer control will need an initialization after it has been rendered on the page and while I can see the end of the track is a proper Backbone component I will make slow increments toward it.
A first injection of Backbone logic is extending the Backbone Events object to use it like an event dispatcher.
The solution works but is redundant (all the controls are being re-initialized each time one of them is rendered) and will not properly work with the current API.
Previous Theme Customizer controls API allowed for controls to render a
data-customize-setting-link attribute in the control markup to have its value saved like the blog name control is doing.
<li id="customize-control-blogname" class="customize-control customize-control-text" style="display: list-item;"> <label> <span class="customize-control-title">Site Title</span> <input type="text" value="WordDotPress" data-customize-setting-link="blogname"> </label> </li>
I will try extending the WordPress provided Control Backbone object to have the control settings saved and tap into the API.