Theme Customizer controls API and me 02

A first non working approach to the Backbone side of things.

Syncing (the rudimentary way)

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.
I’m triggering an event on that Events object when an instance of the control is rendered on the page and hooking into that event to activate the control on a JavaScript level.
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.

Not saving

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;">
        <span class="customize-control-title">Site Title</span>
        <input type="text" value="WordDotPress" data-customize-setting-link="blogname">

That attribute I’m currently rendering in the control markup and while I can enable the option saving in my JS code the data will not be saved to the database.


I will try extending the WordPress provided Control Backbone object to have the control settings saved and tap into the API.