Commit Graph

129 Commits

Author SHA1 Message Date
Weston Ruter
f3f84d2f21 Customize: Require opt-in for selective refresh of widgets.
* Introduces `customize-selective-refresh-widgets` theme support feature and adds to themes.
* Introduces `customize_selective_refresh` arg for `WP_Widget::$widget_options` and adds to all core widgets.
* Remove `selective_refresh` from being a component that can be removed via `customize_loaded_components` filter.
* Add `WP_Customize_Widgets::get_selective_refreshable_widgets()` and `WP_Customize_Widgets::is_widget_selective_refreshable()`.
* Fix default `selector` for `Partial` instances.
* Implement and improve Masronry sidebar refresh logic in Twenty Thirteen and Twenty Fourteen, including preservation of initial widget position after refresh.
* Re-initialize ME.js when refreshing `Twenty_Fourteen_Ephemera_Widget`.

See #27355.
Fixes #35855.

Built from https://develop.svn.wordpress.org/trunk@37040


git-svn-id: http://core.svn.wordpress.org/trunk@37007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-21 21:59:29 +00:00
Drew Jaynes
7696b79d0c Docs: Improve syntax and correct documentation throughout a variety of methods in WP_Customize_Widgets.
See #32246. See #35986.

Built from https://develop.svn.wordpress.org/trunk@36842


git-svn-id: http://core.svn.wordpress.org/trunk@36809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-04 02:02:26 +00:00
Drew Jaynes
66ec5425ea Docs: Improve documentation for WP_Customize_Widgets::customize_dynamic_partial_args(), introduced in [36586].
See #27355. See #35986.

Built from https://develop.svn.wordpress.org/trunk@36841


git-svn-id: http://core.svn.wordpress.org/trunk@36808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-04 01:45:26 +00:00
Weston Ruter
2214f69e43 Customize: Allow controls to be registered without any associated settings.
* Improves parity between partials and controls. A partial or control can be settingless if instantiated with `settings` param as empty array (otherwise, if null, then the partial/control ID is used). 
* Eliminate need to create dummy settings that serve no purpose except to place a control in the UI.
* Removes dummy settings for `create_new_menu` and `new_menu_name`.
* Introduces `WP_Customize_Control::$capability` and `WP_Customize_Partial::$capability`, and if set checks them in the respective `check_capabilities()` methods.
* Prevents PHP fatal error from happening when non-existing settings are provided to control: "Call to a member function `check_capabilities()` on a non-object".
* Fixes issue where nav menu items and widgets were no longer working with selective refresh because cap check was failing.

See #27355.
Fixes #35926.

Built from https://develop.svn.wordpress.org/trunk@36689


git-svn-id: http://core.svn.wordpress.org/trunk@36656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 18:28:28 +00:00
Weston Ruter
49c7012a7e Customize: Ensure dynamic_sidebar() finishes with removing the sidebar ID from the current_dynamic_sidebar_id_stack.
This ensures that widgets appearing after a nested sidebar will continue to be selective refreshable.
 
See #27355.

Built from https://develop.svn.wordpress.org/trunk@36623


git-svn-id: http://core.svn.wordpress.org/trunk@36590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 01:22:26 +00:00
Weston Ruter
ae2657dd32 Customize: Prevent PHP notice and JS error caused by widgets and nav menus components if user only has customize capability.
Short-circuits components from initializing their hooks needlessly if current user lacks required capability.

Fixes #35895.

Built from https://develop.svn.wordpress.org/trunk@36611


git-svn-id: http://core.svn.wordpress.org/trunk@36578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-22 05:31:27 +00:00
Weston Ruter
6b775d4afe Customize: Add selective refresh framework with implementation for widgets and re-implementation for nav menus.
See https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/.

Props westonruter, valendesigns, DrewAPicture, ocean90.
Fixes #27355.

Built from https://develop.svn.wordpress.org/trunk@36586


git-svn-id: http://core.svn.wordpress.org/trunk@36553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-19 18:41:28 +00:00
Weston Ruter
c376477265 Customizer: Export nonce, theme, and url app settings in preview as exported in pane.
* Introduce `WP_Customize_Manager::get_nonces()` to consolidate logic for retrieving nonces.
* Export nonces centrally in `wp.customize.settings.nonce` with each request and update nav menus preview to utilize.
* Send updated nonces to preview upon `nonce-refresh`.
* Request full preview refresh if Nav Menu selective refresh request fails (e.g. due to bad nonce).
* Update nav menus and widgets in Customizer to utilize `customize_refresh_nonces` for exporting nonces and keeping them up to date.

See #27355.
Fixes #35617.

Built from https://develop.svn.wordpress.org/trunk@36414


git-svn-id: http://core.svn.wordpress.org/trunk@36381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-27 17:55:26 +00:00
Gary Pendergast
31f51e2cbb The the Docs: Fix the the dittography
Sometimes, it's easy to to type the the same word twice, especially if if it's a simple word. We probably shouldn't do do do (do do do doo) it, though.

(I've excluded external libs from this change.)

Fixes #34885.


Built from https://develop.svn.wordpress.org/trunk@35793


git-svn-id: http://core.svn.wordpress.org/trunk@35757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-06 21:23:25 +00:00
Weston Ruter
5dae1386aa Customize: Ensure that a setting (especially a multidimensional one) can still be previewed when the post value to preview is set after preview() is invoked.
* Introduce `customize_post_value_set_{$setting_id}` and `customize_post_value_set` actions which are done when `WP_Customize_Manager::set_post_value()` is called.
* Clear the `preview_applied` flag for aggregated multidimensional settings when a post value is set. This ensures the new value is used instead of a previously-cached previewed value.
* Move `$is_preview` property from subclasses to `WP_Customize_Setting` parent class.
* Deferred preview: Ensure that when `preview()` short-circuits due to not being applicable that it will be called again later when the post value is set.
* Populate post value for updated-widget with the (unsanitized) JS-value in `WP_Customize_Widgets::call_widget_update()` so that value will be properly sanitized when accessed in `WP_Customize_Manager::post_value()`.

Includes unit tests with assertions to check the reported issues and validate the fixes.

Fixes defect introduced in [35007].
See #32103.
Fixes #34738.

Built from https://develop.svn.wordpress.org/trunk@35724


git-svn-id: http://core.svn.wordpress.org/trunk@35688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-21 02:52:27 +00:00
Sergey Biryukov
21278f1fc8 Docs: Change variable name in WP_Customize_Widgets::filter_customize_dynamic_setting_args() DocBlock to match the actual variable.
Props mismith227, swissspidy.
Fixes #34426.
Built from https://develop.svn.wordpress.org/trunk@35381


git-svn-id: http://core.svn.wordpress.org/trunk@35345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-24 14:42:26 +00:00
Andrea Fercia
1e1e7a9fc9 Customizer: Make the widgets "Reorder" and "Add a Widget" buttons... buttons.
For accessibility, UI controls should preferably be native controls. Adds
ARIA attributes and labels to improve accessibility and pair these buttons
with the ones in the Menu Customizer.

Props obenland, TomHarrigan, sanket.parmar, metodiew, afercia.

Fixes #33327.
Built from https://develop.svn.wordpress.org/trunk@35304


git-svn-id: http://core.svn.wordpress.org/trunk@35270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 20:15:26 +00:00
Weston Ruter
6bcd8ad757 Customizer: Always show Widgets panel initially if sidebars are registered; show notice to users in panel if no widget areas are in current preview.
Widgets panel will not wait to display until the preview loads.

Also fixes problems with `margin-top` in panels where other panels' `active` states change, as well as ensuring sections of deactivated panel collapse before panel is hidden to prevent the pane from becoming empty of controls.

Fixes #33052.
Fixes #33567.

Built from https://develop.svn.wordpress.org/trunk@35231


git-svn-id: http://core.svn.wordpress.org/trunk@35197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-16 23:48:25 +00:00
Scott Taylor
aa92c9555a Widgets: add a function, is_registered_sidebar() - helps us avoid touching the $wp_registered_sidebars global.
Props GaryJ, wonderboymusic.
Fixes #24878.

Built from https://develop.svn.wordpress.org/trunk@35102


git-svn-id: http://core.svn.wordpress.org/trunk@35067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-13 01:33:25 +00:00
Weston Ruter
208330f2dc Customizer: Defer embedding widget controls to improve DOM performance and initial load time.
The Menu Customizer feature includes a performance technique whereby the controls for nav menu items are only embedded into the DOM once the containing menu section is expanded. This commit implements the same DOM deferral for widgets but goes a step further than just embedding the controls once the widget area's Customizer section is expanded: it also defers the embedding of the widget control's form until the widget is expanded, at which point the `widget-added` event also fires to allow any additional widget initialization to be done. The deferred DOM embedding can speed up initial load time by 10x or more. This DOM deferral also yields a reduction in overall memory usage in the browser process.

Includes changes to `wp_widget_control()` to facilitate separating out the widget form from the surrounding accordion container; also includes unit tests for this previously-untested function. Also included are initial QUnit tests (finally) for widgets in the Customizer.

Fixes #33901.

Built from https://develop.svn.wordpress.org/trunk@34563


git-svn-id: http://core.svn.wordpress.org/trunk@34527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 21:02:27 +00:00
Dominik Schilling
86823a6675 Customizer: Use hash_equals() for widgets.
Built from https://develop.svn.wordpress.org/trunk@33535


git-svn-id: http://core.svn.wordpress.org/trunk@33502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-04 04:51:50 +00:00
Weston Ruter
bf9d1485ee Customizer: Ensure that all existing menus are shown in the Custom Menu widget's dropdown.
* Ensure that a Custom Menu widget selecting a newly-inserted menu gets updated to use the new menu ID upon Save & Publish.
* Dynamically update the visibility of the Custom Menu widget's "no menus" message when the number of menus changes between 0 and 1+.
* Send all dirty Customized settings in `update-widget` Ajax request and `preview()` them so that the widget update/form callbacks have access to any data dependencies in the current Customizer session (such as newly created unsaved menus).
* Update link in Custom Menu widget to point to Menus panel as opposed to Menus admin page, when in the Customizer.
* Fix an issue with extra space at top immediately after creating new menu.
* Fix doubled `update-widget` Ajax requests when changing select dropdown; prevent initial from being aborted.
* Add missing `wp_get_nav_menus()` hooks to preview Customizer updates/inserts for `nav_menu` settings; includes tests.
* Update `wp_get_nav_menu_object()` to allow a menu object to be passed in (and thus passed through).

Props westonruter, adamsilverstein.
Fixes #32814.

Built from https://develop.svn.wordpress.org/trunk@33488


git-svn-id: http://core.svn.wordpress.org/trunk@33455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-29 16:03:24 +00:00
Scott Taylor
a0e373ef80 For doc block types, favor bool over the few remaining booleans
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32964


git-svn-id: http://core.svn.wordpress.org/trunk@32935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:03:25 +00:00
Scott Taylor
5e994cd6a1 Customizer et al, use elseif in PHP, not else if.
This was corrected via brute force in [31090].

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32874


git-svn-id: http://core.svn.wordpress.org/trunk@32845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 22:01:25 +00:00
Scott Taylor
19a3aacc94 Add @static* annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32650


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Dominik Schilling
fccc19b510 Customizer: Replace accordion behavior of sections with a slide-in navigation.
This allows users to focus on the contents of the active section more easily and separating the navigation from the content/controls in the Customizer.

props valendesigns, celloexpressions.
see #31336.
Built from https://develop.svn.wordpress.org/trunk@32649


git-svn-id: http://core.svn.wordpress.org/trunk@32619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 13:57:26 +00:00
Weston Ruter
0f5e6d2825 Fix wp_send_json_error() response for update-widget Ajax request, to return error code instead of error message, as the WP_Error objects are instantiated with codes and the messages are empty.
Fixes #32496.


Built from https://develop.svn.wordpress.org/trunk@32601


git-svn-id: http://core.svn.wordpress.org/trunk@32571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-25 22:09:25 +00:00
Scott Taylor
bd8fafea54 Use void instead of null where appropriate when pipe-delimiting @return types. If a @return only contains void, remove it.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32568


git-svn-id: http://core.svn.wordpress.org/trunk@32538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-24 05:40:25 +00:00
Scott Taylor
082bfab426 Clean up @global doc blocks/imports for class-wp-customizer-*.php and friends.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32542


git-svn-id: http://core.svn.wordpress.org/trunk@32512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 05:06:25 +00:00
Scott Taylor
b2bbbf9759 In class-wp-customize-*, clarify/add some @param/@return blocks. Disambiguate some functions that are trying to return the void response of another function they call internally.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32535


git-svn-id: http://core.svn.wordpress.org/trunk@32505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-21 22:05:24 +00:00
Helen Hou-Sandí
f861754016 Customizer: Better experience for widget filtering in desktop and iOS Safari.
Previously, the search field did not appear at all in desktop Safari, and the auto-focus keyboard fly-up in iOS rendered widget adding frustrating at best.

props dsmart, ocean90.
fixes #31987.

Built from https://develop.svn.wordpress.org/trunk@32243


git-svn-id: http://core.svn.wordpress.org/trunk@32214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-21 14:15:26 +00:00
Dominik Schilling
6d2c70aa0d Customizer: Refresh nonces when a session expires and the user logs in again.
This was broken since 4.0 and the introduction of user session tokens. The nonces are now tied to session tokens as opposed to user IDs, and thus they change with each re-login.
Custom nonces can be added through the `customize_refresh_nonces` filter. On a successful refresh request the JavaScript API will trigger a `nonce-refresh` event. See widget's update nonce as an example.

props westonruter for initial patch.
fixes #31294.
Built from https://develop.svn.wordpress.org/trunk@32054


git-svn-id: http://core.svn.wordpress.org/trunk@32033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-06 15:10:27 +00:00
Drew Jaynes
afdf0fdedc Add missing parameter and return descriptions to WP_Customize_Widgets->filter_customize_dynamic_setting_args().
See [31370]. See #31888.

Built from https://develop.svn.wordpress.org/trunk@32036


git-svn-id: http://core.svn.wordpress.org/trunk@32015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 15:36:26 +00:00
Drew Jaynes
eb7d4e9c31 Add parameter and return descriptions for WP_Customize_Widgets->get_setting_type().
See [31370]. See #31888.

Built from https://develop.svn.wordpress.org/trunk@32035


git-svn-id: http://core.svn.wordpress.org/trunk@32014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 15:19:28 +00:00
Dominik Schilling
b96a624cb9 Customizer: Fix previewing and applying widgets when previewing another theme.
* Unset `wp_get_sidebars_widgets()`' non-admin cache var `$_wp_sidebars_widgets` in Customize theme preview.
* Add `WP_Customize_Setting::$dirty` so that settings can be initially-dirty when the Customizer loads.
* Mark `old_sidebars_widgets_data` setting initially-dirty.
* Mark all `sidebars_widgets` settings as initially-dirty during theme switch.

props westonruter.
see #31484.
Built from https://develop.svn.wordpress.org/trunk@31705


git-svn-id: http://core.svn.wordpress.org/trunk@31686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 22:39:28 +00:00
Drew Jaynes
0c45c387be Add a missing file header to wp-includes/class-wp-customize-widgets.php, separate out the class DocBlock for WP_Customize_Widgets.
Fixes #31446.

Built from https://develop.svn.wordpress.org/trunk@31544


git-svn-id: http://core.svn.wordpress.org/trunk@31525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 08:20:26 +00:00
Dominik Schilling
3aea5f144b Customizer: Introduce an API to create WP_Customize_Settings for dynamically-created settings.
* Introduce WP_Customize_Manager::add_dynamic_settings() to register dynamically-created settings.
* Introduce `customize_dynamic_setting_args` filter to pass an array of args to a dynamic setting's constructor.
* Add unit tests for WP_Customize_Manager and WP_Customize_Widgets.
* See WP_Customize_Widgets as an example.

props westonruter.
fixes #30936.
Built from https://develop.svn.wordpress.org/trunk@31370


git-svn-id: http://core.svn.wordpress.org/trunk@31351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-08 23:11:25 +00:00
Sergey Biryukov
823ab1efdf Customizer: Fix form tag replacement in WP_Customize_Widgets::get_widget_control() after [31200].
see #30126.
Built from https://develop.svn.wordpress.org/trunk@31226


git-svn-id: http://core.svn.wordpress.org/trunk@31207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-17 13:11:23 +00:00
Andrew Ozz
53d22ffb10 Customizer - Widgets: add feedback for screen readers when moving up or down. Props adamsilverstein, afercia. Fixes #28892.
Built from https://develop.svn.wordpress.org/trunk@30760


git-svn-id: http://core.svn.wordpress.org/trunk@30750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 00:45:24 +00:00
Drew Jaynes
ad297dab6d Correctly capitalize JavaScript throughout core docs.
Fixes #30569.

Built from https://develop.svn.wordpress.org/trunk@30695


git-svn-id: http://core.svn.wordpress.org/trunk@30685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-02 00:31:22 +00:00
Scott Taylor
a215b8801d Improve various @param docs for src/wp-includes/class-wp-customize*.php.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30676


git-svn-id: http://core.svn.wordpress.org/trunk@30666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 23:33:23 +00:00
Dominik Schilling
41197a7c31 Customizer: Improve ability to filter active state for widget area Customizer sections.
* Mark panels, sections, controls as active if preview explicitly indicates.
* Introduce `WP_Customize_Sidebar_Section` PHP class, and `SidebarSection` JS class.
* Move logic for determining whether a sidebar section is active from the `SidebarControl` to `SidebarSection`.

props westonruter.
fixes #30235.
Built from https://develop.svn.wordpress.org/trunk@30329


git-svn-id: http://core.svn.wordpress.org/trunk@30328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-13 12:19:23 +00:00
Gary Pendergast
007ec52958 Add wp_json_encode(), a wrapper for json_encode() that ensures everything is converted to UTF-8.
Change all core calls from `json_encode()` to `wp_json_encode()`.

Fixes #28786.


Built from https://develop.svn.wordpress.org/trunk@30055


git-svn-id: http://core.svn.wordpress.org/trunk@30055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 18:35:19 +00:00
Dominik Schilling
61819a36ea Customizer: Change instances of "Theme Customizer" to just "Customizer", as the Customizer isn't necessarily theme-specific.
Also capitalize "Customizer".
See also https://make.wordpress.org/core/2014/07/08/customizer-improvements-in-4-0/.

props studionashvegas, tareq1988.
fixes #29947.
Built from https://develop.svn.wordpress.org/trunk@29903


git-svn-id: http://core.svn.wordpress.org/trunk@29658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-15 17:21:19 +00:00
Andrew Nacin
de569d83a1 Customizer: Mixed priority sorting for panels and top-level sections.
props celloexpressions.
fixes #28979.

Built from https://develop.svn.wordpress.org/trunk@29488


git-svn-id: http://core.svn.wordpress.org/trunk@29266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-14 04:43:16 +00:00
Andrew Nacin
4ecf30559b Verify the MAC earlier in WP_Customize_Widgets. props duck_.
Built from https://develop.svn.wordpress.org/trunk@29377


git-svn-id: http://core.svn.wordpress.org/trunk@29155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-05 06:50:15 +00:00
Drew Jaynes
2c9c48c87b Inline documentation cleanup for 4.0 audit.
phpDoc tweaks for methods, properties, and filters added in [29051]:
* `WP_Customize_Widgets::is_widget_rendered()` method
* `WP_Customize_Widgets::is_sidebar_rendered()` method

See #27993 and #28885.

Built from https://develop.svn.wordpress.org/trunk@29159


git-svn-id: http://core.svn.wordpress.org/trunk@28943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 00:42:15 +00:00
Sergey Biryukov
ad7bc20cb1 Customizer: Introduce WP_Customize_Control::active() method to determine whether the control is relevant to the current context (i.e. to the current URL being previewed).
Control can indicate its active state by a subclass overriding the 'active_callback' method, by supplying a callable 'active_callback' argument into the control's constructor, or by filtering 'customize_control_active'.

props westonruter.
see #27993.
Built from https://develop.svn.wordpress.org/trunk@29051


git-svn-id: http://core.svn.wordpress.org/trunk@28839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-09 23:58:16 +00:00
Sergey Biryukov
0b921efe38 Use wp_hash() instead of AUTH_KEY in WP_Customize_Widgets::get_instance_hash_key().
props juliobox.
fixes #28783.
Built from https://develop.svn.wordpress.org/trunk@29028


git-svn-id: http://core.svn.wordpress.org/trunk@28816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-08 17:17:14 +00:00
Dominik Schilling
b7c93eb3d0 Customizer: Introduce a "panel" API to organize multiple sections into a one section.
Create a panel via `$GLOBALS['wp_customize']->add_panel( $panel_id, $args )` and use `$panel_id` for the `panel` argument in `$GLOBALS['wp_customize']->add_section( $section_id, $args )`. That's it.
As an example all widget area sections are now summarized into one panel. Feedback appreciated.

props celloexpressions.
see #27406.
Built from https://develop.svn.wordpress.org/trunk@28861


git-svn-id: http://core.svn.wordpress.org/trunk@28662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-26 20:17:15 +00:00
Andrew Nacin
dbca0c5e15 Widgets: Remove create_function() from the customizer class.
props westonruter.
fixes #27805.

Built from https://develop.svn.wordpress.org/trunk@28143


git-svn-id: http://core.svn.wordpress.org/trunk@27974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-16 00:11:35 +00:00
Andrew Nacin
efe36dbd5f Add missing string translation in widgets.
see #27453, #27112.

Built from https://develop.svn.wordpress.org/trunk@28140


git-svn-id: http://core.svn.wordpress.org/trunk@27971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-16 00:01:14 +00:00
Andrew Nacin
6b579e0d59 Customizer: Properly handle widget settings when activating a previewed theme.
props westonruter, ocean90, gcorne.
fixes #27767.

Built from https://develop.svn.wordpress.org/trunk@28124


git-svn-id: http://core.svn.wordpress.org/trunk@27955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-14 22:46:16 +00:00
Drew Jaynes
fe6761ccf3 Inline documentation for hooks in wp-includes/class-wp-customize-widgets.php
Fixes #27531.

Built from https://develop.svn.wordpress.org/trunk@28117


git-svn-id: http://core.svn.wordpress.org/trunk@27948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-14 18:41:17 +00:00
Dominik Schilling
3f3a1380d2 Widget Customizer: Fix widget filtering.
props westonruter.
fixes #27451.
Built from https://develop.svn.wordpress.org/trunk@28044


git-svn-id: http://core.svn.wordpress.org/trunk@27874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-08 08:12:15 +00:00
Dominik Schilling
fabc65b787 Widget Customizer: Move WidgetCustomizer to wp.customize.Widgets. First pass.
see #27690.
Built from https://develop.svn.wordpress.org/trunk@27985


git-svn-id: http://core.svn.wordpress.org/trunk@27815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 09:04:14 +00:00
Dominik Schilling
29b1f9a0de Widget Customizer: Remove leading/trailing whitespace to prevent jQuery migrate warning.
props gcorne.
fixes #27689.
Built from https://develop.svn.wordpress.org/trunk@27973


git-svn-id: http://core.svn.wordpress.org/trunk@27803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-06 20:40:15 +00:00
Dominik Schilling
90e62bf6ac Widget Customizer: Minor code cleanup.
* Remove type hinting from `WP_Customize_Widgets`
* Rename `inject_preview_css` to `print_preview_css`
* Remove stray `@todo`

fixes #27534.
Built from https://develop.svn.wordpress.org/trunk@27968


git-svn-id: http://core.svn.wordpress.org/trunk@27798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-06 18:54:14 +00:00
Dominik Schilling
ecee3bcb67 Widget Customizer: Remove leading underscores from public methods.
Fix also an incorrect hook name in `stop_capturing_option_updates()`.

props DrewAPicture.
see #27534.
Built from https://develop.svn.wordpress.org/trunk@27910


git-svn-id: http://core.svn.wordpress.org/trunk@27741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-02 18:31:15 +00:00
Dominik Schilling
cde6d602ea Widget Customizer: Improve plugin compatibility.
Some plugins are using custom scripts and styles for there widgets. These are available on the Widgets screens, but not in the Customizer yet.
Scripts and styles can be enqueued via: 
* `admin_enqueue_scripts`
* `admin_print_scripts` and `admin_print_scripts-widgets.php`
* `admin_print_styles` and `admin_print_styles-widgets.php`
* `admin_print_footer_scripts` and `admin_footer-widgets.php`
All this hooks are now called in the Customizer too.

Previously we have add the `#widgets-right` ID to a container div via jQuery. Remember: `#widgets-right` exists on the Widgets screen and is used by many plugins to do event delegation from that element.
But since our script files are loaded in the footer, the JavaScript way is a bit late for some plugins.
We have decided to add a `div#widgets-right` container element to customizer. "Less hacky hack."

props westonruter, ocean90. Thanks dpe415 for testing.
fixes #27619.
Built from https://develop.svn.wordpress.org/trunk@27907


git-svn-id: http://core.svn.wordpress.org/trunk@27738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-02 17:04:14 +00:00
Drew Jaynes
12e182d929 Coding standards and readability spacing for WP_Customize_Widgets.
Also explicitly re-mark `_capture_filter_pre_update_option()` and `_capture_filter_pre_get_option()` as public.

See #27534.

Built from https://develop.svn.wordpress.org/trunk@27904


git-svn-id: http://core.svn.wordpress.org/trunk@27735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-02 06:12:16 +00:00
Drew Jaynes
44c886045f Second-pass inline documentation improvements for WP_Customize_Widgets.
See #27534.

Built from https://develop.svn.wordpress.org/trunk@27903


git-svn-id: http://core.svn.wordpress.org/trunk@27734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-02 05:45:16 +00:00
Dominik Schilling
da5339da30 Widget Customizer: Add a label to widget search.
props SergeyBiryukov.
fixes #27590.
Built from https://develop.svn.wordpress.org/trunk@27860


git-svn-id: http://core.svn.wordpress.org/trunk@27691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-30 15:47:16 +00:00
Dominik Schilling
016e1f53ba Widget Customizer: Remove strings from WP_Error returns and go with just IDs.
fixes #27419.

Built from https://develop.svn.wordpress.org/trunk@27854


git-svn-id: http://core.svn.wordpress.org/trunk@27685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-29 21:44:14 +00:00
Drew Jaynes
5613b40981 The sidebar_admin_setup hook should only be documented once in wp-admin/widgets.php. All others are duplicates.
See #25374, #25501, #27531.

Built from https://develop.svn.wordpress.org/trunk@27823


git-svn-id: http://core.svn.wordpress.org/trunk@27657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 19:47:15 +00:00
Sergey Biryukov
3a4d9c5953 Widget Customizer: Simplify conditions in setup_widget_addition_previews().
see #27534.
Built from https://develop.svn.wordpress.org/trunk@27820


git-svn-id: http://core.svn.wordpress.org/trunk@27654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 17:09:15 +00:00
Dominik Schilling
c2f839b7b6 Widget Customizer: Simplify nonces.
see #27534.
Built from https://develop.svn.wordpress.org/trunk@27819


git-svn-id: http://core.svn.wordpress.org/trunk@27653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 15:35:15 +00:00
Dominik Schilling
ffa6562965 Widget Customizer: Remove UPDATE_WIDGET_AJAX_ACTION and UPDATE_WIDGET_NONCE_POST_KEY constants.
see #27534.
Built from https://develop.svn.wordpress.org/trunk@27818


git-svn-id: http://core.svn.wordpress.org/trunk@27652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 15:02:13 +00:00
Dominik Schilling
c707faa639 Widget Customizer: Convert static WP_Customize_Widgets class into instantiated class and merge Options_Transaction into WP_Customize_Widgets.
see #27504.
props westonruter.

Built from https://develop.svn.wordpress.org/trunk@27816


git-svn-id: http://core.svn.wordpress.org/trunk@27650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 14:07:14 +00:00
Dominik Schilling
ebdd64f6ad Widget Customizer: Set hightlight color to blue. Same color as in [27741].
fixes #27358.
Built from https://develop.svn.wordpress.org/trunk@27814


git-svn-id: http://core.svn.wordpress.org/trunk@27648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 13:33:14 +00:00
Dominik Schilling
a2eb248e0b Widget Customizer: First pass for inline docs.
props DrewAPicture.
see #27534.
Built from https://develop.svn.wordpress.org/trunk@27753


git-svn-id: http://core.svn.wordpress.org/trunk@27590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-26 22:29:15 +00:00
Dominik Schilling
ea6c9a5515 Widget Customizer: Improve widget highlighting.
* Prefix box-shadow in inject_preview_css()
* Remove border-radius in inject_preview_css()
* Prevent hidden box-shadows in Customizer

see #27358.
Built from https://develop.svn.wordpress.org/trunk@27702


git-svn-id: http://core.svn.wordpress.org/trunk@27541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-25 11:48:14 +00:00
Dominik Schilling
21158f33f7 Widget Customizer: Fix 'WidgetCustomizerPreview' is undefined error in IE8/9.
* Move `WidgetCustomizerPreview` to `wp.customize.WidgetCustomizerPreview`
* Move `WidgetCustomizerPreview_exports` to export_preview_data()
* Use `_wpWidgetCustomizerPreviewSettings` to transfer settings to `wp.customize.WidgetCustomizerPreview`

see #27485.
Built from https://develop.svn.wordpress.org/trunk@27653


git-svn-id: http://core.svn.wordpress.org/trunk@27496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-22 21:04:15 +00:00
Dominik Schilling
9b0ec406d1 Widget Customizer: Improve error handling. First pass.
* Replace Widget_Customizer_Exception with WP_Error
* Call Previewer.cheatin() to show the cheating message if a user can't change widgets
* Call Previewer.login() to show the login form if a user is logged out
* Show a generic error message on failures

see #27419.
Built from https://develop.svn.wordpress.org/trunk@27652


git-svn-id: http://core.svn.wordpress.org/trunk@27495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-22 20:55:18 +00:00
Andrew Nacin
deb8779af5 More translation cleanups.
Affects widgets (see #27112), custom headers (see #21785), theme installer (see #27055, reverts [27614]), and some media stuff. Untranslates some complicated strings that need additional study.

see #27453.

Built from https://develop.svn.wordpress.org/trunk@27620


git-svn-id: http://core.svn.wordpress.org/trunk@27463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 08:18:14 +00:00
Dominik Schilling
a96b9c80b5 Widget Customizer: Remove unused vars.
see #27112.
Built from https://develop.svn.wordpress.org/trunk@27588


git-svn-id: http://core.svn.wordpress.org/trunk@27431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 18:35:16 +00:00
Dominik Schilling
f056bd6f04 Widget Customizer: Remove special filter for Settings Revisions plugin.
see #27112.
Built from https://develop.svn.wordpress.org/trunk@27586


git-svn-id: http://core.svn.wordpress.org/trunk@27429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 16:48:14 +00:00
Dominik Schilling
aaf723a8a8 Widget Customizer: Move preview script to wp_default_scripts().
Built from https://develop.svn.wordpress.org/trunk@27585


git-svn-id: http://core.svn.wordpress.org/trunk@27428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 15:31:16 +00:00
Dominik Schilling
64af78ca43 Widget Customizer: Restore highlighting of widgets in preview.
props westonruter.
see #27358.
Built from https://develop.svn.wordpress.org/trunk@27584


git-svn-id: http://core.svn.wordpress.org/trunk@27427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 15:21:15 +00:00
Dominik Schilling
6b27155163 Widget Customizer: Make temp hooks final and add inline docs.
New hooks are `dynamic_sidebar_before`, `dynamic_sidebar_after`, `dynamic_sidebar_has_widgets ` and `is_active_sidebar`.
Remove obsolete use of hacky dynamic_sidebar hook.

props westonruter, DrewAPicture.
fixes #25368.
Built from https://develop.svn.wordpress.org/trunk@27543


git-svn-id: http://core.svn.wordpress.org/trunk@27386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 20:31:14 +00:00
Dominik Schilling
ca892563a6 Widget Customizer: Move widget area sections to bottom.
Since a theme can have a lot of widget areas and we don't want to bury third-party sections, bump the widget sections to the bottom with a priority of 1000+. Fixes also the ordering.

props westonruter.
fixes #27401.
Built from https://develop.svn.wordpress.org/trunk@27541


git-svn-id: http://core.svn.wordpress.org/trunk@27384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 20:01:14 +00:00
Dominik Schilling
f48e3f5719 Widget Customizer: Move style/script registration to script loader. Update Gruntfile.js.
fixes #27356.
Built from https://develop.svn.wordpress.org/trunk@27525


git-svn-id: http://core.svn.wordpress.org/trunk@27368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-13 19:41:14 +00:00
Dominik Schilling
f46a085f7c Widget Customizer: Use ?wp_customize=on.
Let _wp_customize_include() handle customizer initialisation.
Sets also the priority for the Add Widget and Reorder buttons and removes debug cruft.

props westonruter.
fixes #27291.
Built from https://develop.svn.wordpress.org/trunk@27524


git-svn-id: http://core.svn.wordpress.org/trunk@27367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-13 18:38:14 +00:00
Andrew Nacin
e853a9cc57 Add widget management to the customizer.
This brings in the Widget Customizer plugin: https://wordpress.org/plugins/widget-customizer/.

props westonruter, shaunandrews, michael-arestad, johnregan3, akeda, topher1kenobe, topquarky, bobbravo2, ricardocorreia. And for good measure, props westonruter.
see #27112.

Built from https://develop.svn.wordpress.org/trunk@27419


git-svn-id: http://core.svn.wordpress.org/trunk@27266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-05 20:41:14 +00:00