WordPress/wp-admin/js
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
..
accordion.js Menu customizer: More clearly separate search results from available items. 2015-07-29 23:40:25 +00:00
accordion.min.js Update grunt-contrib-uglify from ~0.10.0 to ~1.0.1 2016-04-15 16:10:37 +00:00
bookmarklet.js
bookmarklet.min.js
color-picker.js Color Picker: when opening and closing, toggle a `wp-picker-active` class on the wrapper. 2015-10-13 01:08:25 +00:00
color-picker.min.js Update grunt-contrib-uglify from ~0.10.0 to ~1.0.1 2016-04-15 16:10:37 +00:00
comment.js Comment status box: Move focus back to Edit link when changing the date. 2015-07-26 02:26:24 +00:00
comment.min.js Comment status box: Move focus back to Edit link when changing the date. 2015-07-26 02:26:24 +00:00
common.js Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs. 2016-05-13 18:41:31 +00:00
common.min.js Update grunt-contrib-uglify from ~0.10.0 to ~1.0.1 2016-04-15 16:10:37 +00:00
custom-background.js
custom-background.min.js
custom-header.js
customize-controls.js Customize: Add setting validation model and control notifications to augment setting sanitization. 2016-05-20 21:10:27 +00:00
customize-controls.min.js Customize: Add setting validation model and control notifications to augment setting sanitization. 2016-05-20 21:10:27 +00:00
customize-nav-menus.js Customize: Allow Esc key to collapse the currently-expanded panel, section (or control). 2016-05-02 19:52:28 +00:00
customize-nav-menus.min.js Customize: Allow Esc key to collapse the currently-expanded panel, section (or control). 2016-05-02 19:52:28 +00:00
customize-widgets.js Customize: Add setting validation model and control notifications to augment setting sanitization. 2016-05-20 21:10:27 +00:00
customize-widgets.min.js Customize: Add setting validation model and control notifications to augment setting sanitization. 2016-05-20 21:10:27 +00:00
dashboard.js JS: in event callbacks replace the very outdated `return false` with `preventDefault()`. 2015-10-09 01:27:27 +00:00
dashboard.min.js JS: in event callbacks replace the very outdated `return false` with `preventDefault()`. 2015-10-09 01:27:27 +00:00
edit-comments.js Comments: Keep comments safe in the Edit Post screen. 2016-04-22 21:43:28 +00:00
edit-comments.min.js Comments: Keep comments safe in the Edit Post screen. 2016-04-22 21:43:28 +00:00
editor-expand.js Editor: fix exiting DFW with the keyboard shortcut on Mac (Opt+Ctrl+W). 2016-03-16 02:48:25 +00:00
editor-expand.min.js Update grunt-contrib-uglify from ~0.10.0 to ~1.0.1 2016-04-15 16:10:37 +00:00
editor.js Editor: Correctly indent definition lists when switching from the visual to the text editor. 2015-12-17 23:06:25 +00:00
editor.min.js Update grunt-contrib-uglify from ~0.10.0 to ~1.0.1 2016-04-15 16:10:37 +00:00
farbtastic.js
gallery.js JS: in event callbacks replace the very outdated `return false` with `preventDefault()`. 2015-10-09 01:27:27 +00:00
gallery.min.js JS: in event callbacks replace the very outdated `return false` with `preventDefault()`. 2015-10-09 01:27:27 +00:00
image-edit.js Media: make the Image Editor usable with a keyboard. 2016-01-08 19:13:26 +00:00
image-edit.min.js Update grunt-contrib-uglify from ~0.10.0 to ~1.0.1 2016-04-15 16:10:37 +00:00
inline-edit-post.js Quick/Bulk Edit: Remove a no more used jQuery loop for unsupported post formats. 2016-01-21 22:50:25 +00:00
inline-edit-post.min.js Quick/Bulk Edit: Remove a no more used jQuery loop for unsupported post formats. 2016-01-21 22:50:25 +00:00
inline-edit-tax.js Accessibility: make the tab order match the visual order in the Edit terms screens. 2016-05-16 13:02:29 +00:00
inline-edit-tax.min.js Accessibility: make the tab order match the visual order in the Edit terms screens. 2016-05-16 13:02:29 +00:00
iris.min.js
language-chooser.js
language-chooser.min.js
link.js
link.min.js
media-gallery.js
media-gallery.min.js
media-upload.js jQuery: Replace the use of the `.size()` method with the `.length` property. 2016-01-13 16:17:27 +00:00
media-upload.min.js jQuery: Replace the use of the `.size()` method with the `.length` property. 2016-01-13 16:17:27 +00:00
media.js
media.min.js
nav-menu.js Coding standards after [36510]. 2016-03-10 23:18:26 +00:00
nav-menu.min.js Menus: Allow larger menus to be created in the Edit Menu screen. 2016-02-11 19:08:27 +00:00
password-strength-meter.js Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs. 2016-05-13 18:41:31 +00:00
password-strength-meter.min.js
plugin-install.js Plugin Install: show the upload form in place rather than sending users to the devoted upload plugin page. 2016-04-16 16:43:27 +00:00
plugin-install.min.js Plugin Install: show the upload form in place rather than sending users to the devoted upload plugin page. 2016-04-16 16:43:27 +00:00
post.js Comments: Keep comments safe in the Edit Post screen. 2016-04-22 21:43:28 +00:00
post.min.js Comments: Keep comments safe in the Edit Post screen. 2016-04-22 21:43:28 +00:00
postbox.js Docs: Fix typo in a comment in `wp-admin/js/postbox.js`. 2016-04-13 07:29:27 +00:00
postbox.min.js Administration: Add a "Drag boxes here" message to empty dashboard meta boxes so it's clear to users that it's possible to drag meta boxes into empty spaces. 2016-01-14 04:13:26 +00:00
press-this.js Accessibility: add missing `alt` attributes to a gaggle of `<img>`s. 2015-11-07 16:12:27 +00:00
press-this.min.js Update grunt-contrib-uglify from ~0.10.0 to ~1.0.1 2016-04-15 16:10:37 +00:00
revisions.js Spelling: Standardize on "front end"/"back end" (noun) and "front-end"/"back-end" (adjective). 2016-02-25 12:53:27 +00:00
revisions.min.js Update grunt-contrib-uglify from ~0.10.0 to ~1.0.1 2016-04-15 16:10:37 +00:00
set-post-thumbnail.js
set-post-thumbnail.min.js
svg-painter.js
svg-painter.min.js
tags-box.js Tags: Avoid a double trailing space after tags separator in auto-suggest. 2015-10-20 16:00:30 +00:00
tags-box.min.js Update grunt-contrib-uglify from ~0.10.0 to ~1.0.1 2016-04-15 16:10:37 +00:00
tags.js
tags.min.js
theme.js Plugin Install: show the upload form in place rather than sending users to the devoted upload plugin page. 2016-04-16 16:43:27 +00:00
theme.min.js Plugin Install: show the upload form in place rather than sending users to the devoted upload plugin page. 2016-04-16 16:43:27 +00:00
updates.js Refine the FTP credentials form interaction. 2016-05-19 22:59:28 +00:00
updates.min.js Refine the FTP credentials form interaction. 2016-05-19 22:59:28 +00:00
user-profile.js Passwords: Hide weak password confirmation checkbox when password strength improves. 2015-12-11 21:54:27 +00:00
user-profile.min.js Passwords: Hide weak password confirmation checkbox when password strength improves. 2015-12-11 21:54:27 +00:00
user-suggest.js
user-suggest.min.js
widgets.js Widgets: add a button to delete all inactive widgets simultaneously for better UX. 2015-10-21 05:23:26 +00:00
widgets.min.js Widgets: add a button to delete all inactive widgets simultaneously for better UX. 2015-10-21 05:23:26 +00:00
word-count.js Editor: word count: better names for types. 2015-07-27 11:19:26 +00:00
word-count.min.js Editor: word count: better names for types. 2015-07-27 11:19:26 +00:00
wp-fullscreen-stub.js Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs. 2016-05-13 18:41:31 +00:00
wp-fullscreen-stub.min.js
xfn.js
xfn.min.js