mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-13 22:26:06 +01:00
87b0a1b989
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 |
||
---|---|---|
.. | ||
crop | ||
imgareaselect | ||
jcrop | ||
jquery | ||
mediaelement | ||
plupload | ||
swfupload | ||
thickbox | ||
tinymce | ||
admin-bar.js | ||
admin-bar.min.js | ||
autosave.js | ||
autosave.min.js | ||
backbone.min.js | ||
colorpicker.js | ||
colorpicker.min.js | ||
comment-reply.js | ||
comment-reply.min.js | ||
customize-base.js | ||
customize-base.min.js | ||
customize-loader.js | ||
customize-loader.min.js | ||
customize-models.js | ||
customize-models.min.js | ||
customize-preview-nav-menus.js | ||
customize-preview-nav-menus.min.js | ||
customize-preview-widgets.js | ||
customize-preview-widgets.min.js | ||
customize-preview.js | ||
customize-preview.min.js | ||
customize-selective-refresh.js | ||
customize-selective-refresh.min.js | ||
customize-views.js | ||
customize-views.min.js | ||
heartbeat.js | ||
heartbeat.min.js | ||
hoverIntent.js | ||
hoverIntent.min.js | ||
json2.js | ||
json2.min.js | ||
masonry.min.js | ||
mce-view.js | ||
mce-view.min.js | ||
media-audiovideo.js | ||
media-audiovideo.min.js | ||
media-editor.js | ||
media-editor.min.js | ||
media-grid.js | ||
media-grid.min.js | ||
media-models.js | ||
media-models.min.js | ||
media-views.js | ||
media-views.min.js | ||
quicktags.js | ||
quicktags.min.js | ||
shortcode.js | ||
shortcode.min.js | ||
swfobject.js | ||
tw-sack.js | ||
tw-sack.min.js | ||
twemoji.js | ||
twemoji.min.js | ||
underscore.min.js | ||
utils.js | ||
utils.min.js | ||
wp-a11y.js | ||
wp-a11y.min.js | ||
wp-ajax-response.js | ||
wp-ajax-response.min.js | ||
wp-auth-check.js | ||
wp-auth-check.min.js | ||
wp-backbone.js | ||
wp-backbone.min.js | ||
wp-embed-template.js | ||
wp-embed-template.min.js | ||
wp-embed.js | ||
wp-embed.min.js | ||
wp-emoji-loader.js | ||
wp-emoji-loader.min.js | ||
wp-emoji-release.min.js | ||
wp-emoji.js | ||
wp-emoji.min.js | ||
wp-list-revisions.js | ||
wp-list-revisions.min.js | ||
wp-lists.js | ||
wp-lists.min.js | ||
wp-pointer.js | ||
wp-pointer.min.js | ||
wp-util.js | ||
wp-util.min.js | ||
wpdialog.js | ||
wpdialog.min.js | ||
wplink.js | ||
wplink.min.js | ||
zxcvbn-async.js | ||
zxcvbn-async.min.js | ||
zxcvbn.min.js |