[wp-trac] [WordPress Trac] #28093: Backbonify widgets admin UI
WordPress Trac
noreply at wordpress.org
Fri May 2 18:42:52 UTC 2014
#28093: Backbonify widgets admin UI
-------------------------+------------------------------
Reporter: westonruter | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: javascript
-------------------------+------------------------------
Comment (by westonruter):
Replying to [comment:2 DrewAPicture]:
> > The widgets admin UI needs a rewrite to utilize Backbone.
>
> What justification is there for rewriting this workflow other than just
to use Backbone? Are there user tests showing that this workflow needs to
be rethought? Is the workflow broken?
>
> Or is this simply rewriting to rewrite with Backbone? If it's the
latter, I don't think that's ample justification.
>
> Don't get me wrong, I'm all in favor of kaizen when it comes to our code
base, I'd just like to hear more about why a complete overhaul is
necessary and justified.
Absolutely. Yeah, it's not just to rewrite for rewrites sake. There are a
few reasons for doing this, which I need to flesh out more fully (and will
need to be done in the description here).
For example: The addition of the `widget-added` and `widget-updated` hooks
(#19675, #27491) required them to be added to be three separate areas of
the codebase because there is duplicated logic, making maintenance a
headache. Introducing widget management in other areas, for example in a
TinyMCE view or in a frontend editor, would require yet more duplications
of the widget control form logic.
Another example: Currently when a widget gets added to a widget area, a
hidden "template" widget control element gets cloned and then injected
into the widget area. This causes all kinds of problems with event
listeners and dynamically-built controls (e.g. via jQuery UI) since the
cloned element don't come with the template's event listeners and bound
data. Widgets controls should instead follow the Backbone model of having
an underlying template string which gets constructed into a view.
There is no JS API (or PHP API for that matter) for manipulating widgets.
Using Backbone for a standard JS Widget API would allow core (and plugins)
to have a unified interface for managing widgets, and allow them to be
easily used in many more contexts. Adding widgets to the customizer would
have been much easier if there was such a Backbone API for managing
widgets.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28093#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list