[wp-trac] [WordPress Trac] #5583: New widgets interface
WordPress Trac
wp-trac at lists.automattic.com
Fri Jan 4 23:09:59 GMT 2008
#5583: New widgets interface
-------------------------+--------------------------------------------------
Reporter: mdawaffe | Owner: anonymous
Type: enhancement | Status: new
Priority: normal | Milestone: 2.5
Component: General | Version: 2.5
Severity: normal | Keywords: has-patch
-------------------------+--------------------------------------------------
Attached is a patch for the new widgets interface.
Features
1. Can filter widgets by simple search and/or whether or not you're
currently using them.
2. Widgets can now be given descriptions (all core widgets have
descriptions in this patch).
3. Addition/Removal via mouse clicks rather than drag and drop.
4. Sorting via drag and drop.
5. More or less friendly to those without JS: you can still add, remove,
and update widgets without JS. You cannot currently change their order
without JS.
Issues
1. Each widget has a save button, but it doesn't actually save the data.
You need to click the "global" "Save Changes" button. The individual save
buttons should maybe be relabeled "OK" buttons.
2. Cannot drag a widget from one sidebar to another.
3. The CSS for this page was kept separate from wp-admin.css do reduce
conflicts during "The great redesign of fiscal year 2008". It's in wp-
admin/includes/widgets.php:temp_widget_css() and should be unified and
merged with wp-admin.css at some point.
4. The CSS is rough cut. It will need some polish.
Widgets can be written so that an arbitrary number of instances of that
widget may appear in your sidebars. There is no longer a need for the
hacky "How many text widgets do you want" UI.
Replacing that hack is another: widgets that want to allow multiple
instances should accept a 'number' argument, provide an 'id_base' (so that
unique widget ids can be constructed from {id_base}-{number}, and have a
widget_control form that can be used as a template for generating control
forms for each instance (and for new instances during JS on-the-fly).
Included in this patch are several examples (the text widget, the
categories widget, the rss widget) of such "many instance widgets". Also
included are some docs that:
1. Detail what a "many instance widget" control form should look like.
2. Offer a pattern for creating your own "many instance widgets".
These docs are located in a comment block at the end of wp-
includes/widgets.php.
Things to note:
1. Widget id#s are no longer persistent across multiple updates. In
order to prevent duplication or poisoning within or between different
sidebars, widgets that allow mulitple instances will have widget ids that
look like {id_base}-{timestamp . incrementor}.
2. The JS is not yet internationalized.
Everything should work cleanly, but please back any important widget data
before testing this just in case.
--
Ticket URL: <http://trac.wordpress.org/ticket/5583>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list