diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 320f892..631df0b 100644
|
|
|
|
| 3461 | 3461 | // Add notifications for invalidities. |
| 3462 | 3462 | if ( _.isObject( validity ) ) { |
| 3463 | 3463 | _.each( validity, function( params, code ) { |
| 3464 | | var notification = new api.Notification( code, params ), existingNotification, needsReplacement = false; |
| | 3464 | var notification, existingNotification, needsReplacement = false; |
| | 3465 | notification = new api.Notification( code, _.extend( { fromServer: true }, params ) ); |
| 3465 | 3466 | |
| 3466 | 3467 | // Remove existing notification if already exists for code but differs in parameters. |
| 3467 | 3468 | existingNotification = setting.notifications( notification.code ); |
| 3468 | 3469 | if ( existingNotification ) { |
| 3469 | | needsReplacement = ( notification.type !== existingNotification.type ) || ! _.isEqual( notification.data, existingNotification.data ); |
| | 3470 | needsReplacement = notification.type !== existingNotification.type || notification.message !== existingNotification.message || ! _.isEqual( notification.data, existingNotification.data ); |
| 3470 | 3471 | } |
| 3471 | 3472 | if ( needsReplacement ) { |
| 3472 | 3473 | setting.notifications.remove( code ); |
| … |
… |
|
| 3715 | 3716 | */ |
| 3716 | 3717 | api.each( function( setting ) { |
| 3717 | 3718 | setting.notifications.each( function( notification ) { |
| 3718 | | if ( 'error' === notification.type && ( ! notification.data || ! notification.data.from_server ) ) { |
| | 3719 | if ( 'error' === notification.type && ! notification.fromServer ) { |
| 3719 | 3720 | invalidSettings.push( setting.id ); |
| 3720 | 3721 | } |
| 3721 | 3722 | } ); |
diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index 5ee3b6d..668989b 100644
|
|
|
final class WP_Customize_Manager {
|
| 1046 | 1046 | if ( is_wp_error( $validity ) ) { |
| 1047 | 1047 | $notification = array(); |
| 1048 | 1048 | foreach ( $validity->errors as $error_code => $error_messages ) { |
| 1049 | | $error_data = $validity->get_error_data( $error_code ); |
| 1050 | | if ( is_null( $error_data ) ) { |
| 1051 | | $error_data = array(); |
| 1052 | | } |
| 1053 | | $error_data = array_merge( |
| 1054 | | $error_data, |
| 1055 | | array( 'from_server' => true ) |
| 1056 | | ); |
| 1057 | 1049 | $notification[ $error_code ] = array( |
| 1058 | 1050 | 'message' => join( ' ', $error_messages ), |
| 1059 | | 'data' => $error_data, |
| | 1051 | 'data' => $validity->get_error_data( $error_code ), |
| 1060 | 1052 | ); |
| 1061 | 1053 | } |
| 1062 | 1054 | return $notification; |
diff --git src/wp-includes/js/customize-base.js src/wp-includes/js/customize-base.js
index e59f926..20bb74a 100644
|
|
|
window.wp = window.wp || {};
|
| 762 | 762 | * @augments wp.customize.Class |
| 763 | 763 | * @since 4.6.0 |
| 764 | 764 | * |
| 765 | | * @param {string} code The error code. |
| 766 | | * @param {object} params Params. |
| 767 | | * @param {string} params.message The error message. |
| 768 | | * @param {string} [params.type=error] The notification type. |
| 769 | | * @param {*} [params.data] Any additional data. |
| | 765 | * @param {string} code - The error code. |
| | 766 | * @param {object} params - Params. |
| | 767 | * @param {string} params.message=null - The error message. |
| | 768 | * @param {string} [params.type=error] - The notification type. |
| | 769 | * @param {boolean} [params.fromServer=false] - Whether the notification was server-sent. |
| | 770 | * @param {string} [params.setting=null] - The setting ID that the notification is related to. |
| | 771 | * @param {*} [params.data=null] - Any additional data. |
| 770 | 772 | */ |
| 771 | 773 | api.Notification = api.Class.extend({ |
| 772 | 774 | initialize: function( code, params ) { |
| | 775 | var _params; |
| 773 | 776 | this.code = code; |
| 774 | | this.message = params.message; |
| 775 | | this.type = params.type || 'error'; |
| 776 | | this.data = params.data || null; |
| | 777 | _params = _.extend( |
| | 778 | { |
| | 779 | message: null, |
| | 780 | type: 'error', |
| | 781 | fromServer: false, |
| | 782 | data: null, |
| | 783 | setting: null |
| | 784 | }, |
| | 785 | params |
| | 786 | ); |
| | 787 | delete _params.code; |
| | 788 | _.extend( this, _params ); |
| 777 | 789 | } |
| 778 | 790 | }); |
| 779 | 791 | |