Commit Graph

75 Commits

Author SHA1 Message Date
Weston Ruter
87b0a1b989 Customize: Add setting validation model and control notifications to augment setting sanitization.
When a setting is invalid, not only will it be blocked from being saved but all other settings will be blocked as well. This ensures that Customizer saves aren't partial but are more transactional. User will be displayed the error in a notification so that they can fix and re-attempt saving.

PHP changes:

* Introduces `WP_Customize_Setting::validate()`, `WP_Customize_Setting::$validate_callback`, and the `customize_validate_{$setting_id}` filter.
* Introduces `WP_Customize_Manager::validate_setting_values()` to do validation (and sanitization) for the setting values supplied, returning a list of `WP_Error` instances for invalid settings.
* Attempting to save settings that are invalid will result in the save being blocked entirely, with the errors being sent in the `customize_save_response`. Modifies `WP_Customize_Manager::save()` to check all settings for validity issues prior to calling their `save` methods.
* Introduces `WP_Customize_Setting::json()` for parity with the other Customizer classes. This includes exporting of the `type`.
* Modifies `WP_Customize_Manager::post_value()` to apply `validate` after `sanitize`, and if validation fails, to return the `$default`.
* Introduces `customize_save_validation_before` action which fires right before the validation checks are made prior to saving.

JS changes:

* Introduces `wp.customize.Notification` in JS which to represent `WP_Error` instances returned from the server when setting validation fails.
* Introduces `wp.customize.Setting.prototype.notifications`.
* Introduces `wp.customize.Control.prototype.notifications`, which are synced with a control's settings' notifications.
* Introduces `wp.customize.Control.prototype.renderNotifications()` to re-render a control's notifications in its notification area. This is called automatically when the notifications collection changes.
* Introduces `wp.customize.settingConstructor`, allowing custom setting types to be used in the same way that custom controls, panels, and sections can be made.
* Injects a notification area into existing controls which is populated in response to the control's `notifications` collection changing. A custom control can customize the placement of the notification area by overriding the new `getNotificationsContainerElement` method.
* When a save fails due to setting invalidity, the invalidity errors will be added to the settings to then populate in the controls' notification areas, and the first such invalid control will be focused.

Props westonruter, celloexpressions, mrahmadawais.
See #35210.
See #30937.
Fixes #34893.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-20 21:10:27 +00:00
Weston Ruter
dcf6cf3615 Customize: Include shortcut button in Custom Menu widget to edit the selected menu in the Customizer.
Clicking on the Edit Menu button focuses on the corresponding nav menu section. Upon collapsing the nav menu section, the focus is returned to the Custom Menu widget instead of taking the user to the menus root panel. In this way, the back button behavior is modified once to serve as breadcrumb/history navigation. The Edit Menu button with the breadcrumb back button behavior greatly reduce the number of UI interactions needed to edit a menu referenced in a Custom Menu widget.

Props celloexpressions, westonruter.
Fixes #32683.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-16 07:22:30 +00:00
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
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
Dominik Schilling
4693b25171 Update Backbone and Underscore to the latest versions.
Backbone, from 1.1.2 to 1.2.3. Underscore, from 1.6.0 to 1.8.3.

The new versions of Backbone and Underscore offer numerous small bug fixes and some optimizations and other improvements. Check the [http://backbonejs.org/#changelog Backbone changelog] and [http://underscorejs.org/#changelog Underscore changelog] for the full details. 

The new versions include some significant changes that may break existing code. Plugins or themes that rely on the bundled Backbone and/or Underscore libraries should carefully check functionality with the latest versions and run any available unit tests to ensure compatibility.

Some changes of note that were addressed in core as part of this upgrade:

* `_.flatten` no longer works with objects since Underscore.js 1.7. `_.flatten()` working with objects was an unintended side-affect of the implementation, see [https://github.com/jashkenas/underscore/issues/1904#issuecomment-60241576 underscore#1904]. Check any `_flatten` usage and only flatten arrays.
* As of Backbone 1.2.0, you can no longer modify the `events` hash or your view's `el` property in `initialize`, so don't try to modify them there. 
* Since Underscore 1.7, Underscore templates no longer accept an initial data object. `_.template` always returns a function now so make sure you use it that way.

Props adamsilverstein.
Fixes #34350.
Built from https://develop.svn.wordpress.org/trunk@36546


git-svn-id: http://core.svn.wordpress.org/trunk@36513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-17 15:22:26 +00:00
Weston Ruter
453ff22d7f Customize: Hide widgets re-order button when no re-ordering is possible.
Hide the re-order button if there are no widgets in the sidebar, or if there is there is only one sidebar and there is only one widget in the sidebar.

Props rabmalin, westonruter.
Fixes #35533.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-12 23:52:27 +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
2e98e461a2 Customize: Fix auto-expand (and focus) on newly added widgets.
Add widget controls with an initially-true `active` state so that calling `expand()` will not be short-circuited. Previously the `active` state would be set once the preview refreshes, but this happens too late for the `addWidget` call. Fixes regression introduced in [35231].

Fixes #34514.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-01 22:27: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
Weston Ruter
aa044b054e Customizer: Ensure that wp.customize.Widgets.savedWidgetIds is defined up front.
In 4.3 the widget controls were fully initialized up front along with the sidebar controls. The sidebar control depended (unnecessarily) on the widget control to ensure that `wp.customize.Widgets.savedWidgetIds` was defined. So after [34563] there could be a situation where the widgets are added/removed from a sidebar before their controls are initialized (if the sidebar section is never expanded), resulting in an error attempting to get a property off of an undefined value. So this change does the right thing and defines `savedWidgetIds` up front.

Also changes the `savedWidgetIds` variable type from an array to an object, to match how it is used as a dictionary lookup.

See #33901.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 21:59: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
45b8634605 Customizer: Remove obsolete .control-panel-back and .customize-overlay-close buttons.
props afercia, ocean90.
see #31336.
fixes #33229.
Built from https://develop.svn.wordpress.org/trunk@33599


git-svn-id: http://core.svn.wordpress.org/trunk@33566 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-09 19:00:24 +00:00
Dominik Schilling
04c21a0e3c Customizer: Restore Shift + Clicking on widgets to open the widgets panel.
Includes an alternative for jQuery UI's `:focusable` selector because it has an ancestor visibility requirement, see https://github.com/jquery/jquery-ui/pull/1583.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-08 09:37:26 +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
John Blackbourn
acec5066f6 Switch to pointer tolerance for improved drag and drop behaviour when reordering widgets.
Props jkudish, MikeHansenMe.
Fixes #20791

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


git-svn-id: http://core.svn.wordpress.org/trunk@32659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-03 22:59:25 +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
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
Dominik Schilling
4f3fb2315d Customize Widgets: Improve sync logic for select[multiple] inputs.
The current logic doesn't account for the special case of `select[multiple]` inputs which lack a single value to synchronize: The value to synchronize is an array of zero or more values.
This change replaces `_getInputStatePropertyName()` with `_getInputState()`, which returns the state for an input depending on its type, and `_setInputState()`, which updates an input's state based on its type.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-04 16:34:26 +00:00
Dominik Schilling
942c6a9edc Customizer: Update selector, missed in [31984].
see #28784.
Built from https://develop.svn.wordpress.org/trunk@31985


git-svn-id: http://core.svn.wordpress.org/trunk@31964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-02 17:18:25 +00:00
Dominik Schilling
ba7f53f029 Customizer: Make the available widgets overlay closable on narrow screens.
see #28784.
Built from https://develop.svn.wordpress.org/trunk@31974


git-svn-id: http://core.svn.wordpress.org/trunk@31953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-01 22:25:28 +00:00
Dominik Schilling
c4a624aa22 Customizer: Remove a throw error call which prevents further actions, like jqxhr.always().
props westonruter.
fixes #31501.
Built from https://develop.svn.wordpress.org/trunk@31816


git-svn-id: http://core.svn.wordpress.org/trunk@31798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-18 19:29:27 +00:00
Dominik Schilling
9250d59e6a Customizer: Prevent a race condition when attempting to publish too soon after updating widget form fields with multiple edits.
props westonruter.
fixes #31501.
Built from https://develop.svn.wordpress.org/trunk@31706


git-svn-id: http://core.svn.wordpress.org/trunk@31687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 22:45:27 +00:00
Andrew Ozz
5e07bfdfd1 Add wp.a11y.speak() for audible alerts/updates in screen readers. Props afercia, GrahamArmfield (for the idea), iseulde. Fixes #31368.
Built from https://develop.svn.wordpress.org/trunk@31594


git-svn-id: http://core.svn.wordpress.org/trunk@31575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-01 19:11:27 +00:00
Dominik Schilling
789cd2e824 Customize Widgets: Don't return undefined items in getWidgetFormControls method.
props westonruter.
fixes #31465.
Built from https://develop.svn.wordpress.org/trunk@31570


git-svn-id: http://core.svn.wordpress.org/trunk@31551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-27 10:35:24 +00:00
Dominik Schilling
70ca74b37b Customizer: Don't focus new widgets if they are added programmatically.
props westonruter.
fixes #31295.
Built from https://develop.svn.wordpress.org/trunk@31428


git-svn-id: http://core.svn.wordpress.org/trunk@31409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-11 23:32:27 +00:00
Dominik Schilling
6adb5c0618 Customizer: Improve [31252] to show the move-widget buttons only if there is more than one *rendered* sidebar.
fixes #30690.
Built from https://develop.svn.wordpress.org/trunk@31419


git-svn-id: http://core.svn.wordpress.org/trunk@31400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-11 20:45:26 +00:00
Dominik Schilling
b4bb289b5d Customizer: Hide the reorder-widgets button when a widget area is empty.
props celloexpressions.
fixes #27787.
Built from https://develop.svn.wordpress.org/trunk@31255


git-svn-id: http://core.svn.wordpress.org/trunk@31236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-20 22:45:22 +00:00
Dominik Schilling
0c0675627b Customizer: If there's only one available sidebar, hide the move-widget button.
props celloexpressions.
fixes #30690.
Built from https://develop.svn.wordpress.org/trunk@31252


git-svn-id: http://core.svn.wordpress.org/trunk@31233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-20 20:36:21 +00:00
Dominik Schilling
14abcecf81 Customizer: Use correct event variable when moving widgets to another widget area.
Fixes "ReferenceError: event is not defined error." in Firefox.

props tywayne.
fixes #30818.
Built from https://develop.svn.wordpress.org/trunk@30992


git-svn-id: http://core.svn.wordpress.org/trunk@30974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-23 17:24:24 +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
Scott Taylor
097e4ede58 Add some inline JS docs for Customizer.
See #30469.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-04 02:04:22 +00:00
Dominik Schilling
d187a5eeba Customizer: Don't override Section.isContextuallyActive() in SidebarSection.
This fixes a bug where empty widget areas get deactivated in the Customizer.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 22:26: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
Dominik Schilling
8b32164b67 Customizer: Trigger widget-added event when initializing.
Widget controls are now added to the pane dynamically via JavaScript, see #28709.
Remove the event trigger from `SidebarControl.addWidget()` as it's covered by `WidgetControl.ready()`.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-11 22:46:23 +00:00
Dominik Schilling
d21799ee1f Customizer: Use jQuery.fn.toggle() instead of slideUp/slideDown if panel/section/control is not inserted into DOM yet.
jQuery does nothing when calling `slideUp` on elements that are not inserted into the DOM yet, which can now be the case now when first loading the Customizer as the panels, sections and controls get dynamically inserted, see #28709.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-11 22:37:22 +00:00
Dominik Schilling
00845a6c3d Customizer: Fix missing newly added widgets in the preview after [29905].
props westonruter.
fixes #29983.
Built from https://develop.svn.wordpress.org/trunk@30104


git-svn-id: http://core.svn.wordpress.org/trunk@30104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 22:57:23 +00:00
Dominik Schilling
3c962ee5d8 Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.

https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.

props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 22:51:22 +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
Sergey Biryukov
81f912dd7a Customizer: Remove "Add a Widget" button from tab order when reordering widgets.
fixes #28890.
Built from https://develop.svn.wordpress.org/trunk@29243


git-svn-id: http://core.svn.wordpress.org/trunk@29027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-19 03:32:17 +00:00
Sergey Biryukov
37e51e558c Customizer: When widget reorder button is actioned, transfer focus to the first Move control within the section.
fixes #28891.
Built from https://develop.svn.wordpress.org/trunk@29242


git-svn-id: http://core.svn.wordpress.org/trunk@29026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-19 03:24:15 +00:00
Sergey Biryukov
9a02dabf34 Customizer: Add widget title to Move/Up/Down controls to provide context for screen readers when reordering or moving widgets.
fixes #28889.
Built from https://develop.svn.wordpress.org/trunk@29238


git-svn-id: http://core.svn.wordpress.org/trunk@29022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-19 01:58:15 +00:00
Sergey Biryukov
53d2839324 Customizer: Avoid losing focus when adding widgets via keyboard.
props sathishn.
fixes #28835.
Built from https://develop.svn.wordpress.org/trunk@29237


git-svn-id: http://core.svn.wordpress.org/trunk@29021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-19 01:19:14 +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
3b291f7057 Customizer: Export Previewer instance to wp.customize.previewer, and utilize for Widget Customizer.
props westonruter.
fixes #27666.
Built from https://develop.svn.wordpress.org/trunk@29048


git-svn-id: http://core.svn.wordpress.org/trunk@28836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-09 20:58: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
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
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