- Notifications
You must be signed in to change notification settings - Fork 17
Add support for adding widgets #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| See also the following customizer concept from the Widgets UI Refresh, featured in the Aug 26, 2013 meeting summary: |
| See also my concerns about the above concept, specifically the "Select a template to add widgets to" part. |
| I just realized a compact UI for adding widgets the Widget Customizer: as part of the (hidden) control for storing the widget orders, we could also include a drop-down of all registered widgets along with a button to add. Clicking add would insert a new widget form control at the top of the list, after which it could then be dragged to its desired location (see #1). |
| @westonruter I was initially thinking this made sense as an additional control - however - the SRP dictates that there be two separate controls: one for adding new widgets, and another to control widget preview order. I'll give you some feedback on my thoughts RE: separate control for widget order on #14 |
| @bobbravo2 sorry, what does “SRP” mean? |
| Related to @westonruter recent comment on #16, here's a minor tweak that would work better with horizontally oriented widgets: |
| @shaunandrews so for horizontally-oriented widgets, would this ADD WIDET divider/button be rotated 90°? |
| @westonruter sorry... I'm an acronym geek..: SRP Single Responsibility Principal. |
| @bobbravo2 thanks 😄 So regarding SRP, I think what I worked on over the weekend makes sense. The new control is "sidebar widgets" and it is for the setting which is just an array of the widget IDs contained in the sidebar. So since the setting itself handles both the ordering of the widgets, and which widgets are contained in the sidebar, it seems the customizer control can also logically manage both the ordering and the adding/removing of widgets from sidebars. I think it worked out quite cleanly, if you look at the changes on #1 and then how easy it was to add dragging between sidebars in #24. |
| I'm doing work in the |
Setting is not yet hooked up with preview
Allow old widgets to be resurrected, e.g. via Settings Revisions Ensure widgets added in customizer persist
| I've reached a beta state for this widget addition feature. |
Remove dead code
| @westonruter love the drop down for adding new widgets - that's what I was hoping for. What do you think about adding the Chosen jQuery plugin to enhance it with search (search a widget's description / title / possible alternate keywords for new users)? Chosen Demo |
| @bobbravo2 yes, I'd love to add Chosen or Select2 to improve the usability of the dropdown. From the Chosen demo, I assume the Standard Select or the Standard Select with optgroup would be the field we'd be interested in? I guess too we'll want to let the autocomplete match not only the title of the widget, but its description as well? |
The retrieve_widgets() function may have been causing the problem.
Add support for adding widgets
| Well, that was an epic effort. So happy with how it turned out! 😆 |
| To see the behavior for old-style single (non-multi) widgets, try this plugin which adds a test one: https://gist.github.com/westonruter/7141599 |
| +1 for Select2 |





It would be great if the great new widgets UI you're working on could be embedded within in a lightbox window that appears over the window when using the customizer (just like when you open the media manager). Widgets could then be dragged into the relevant customizer sections in the customizer panel (each sidebar could have its own section), and the preview window could then update to show the user what the site looks like with that widget added.
widgets_sidebarssetting.)$_POST)customize_registerhappenspreview_new_widgets)