From e2602102945fcb17b65ef1c3ec2dbc528e77c726 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 13 Nov 2017 21:18:49 +0000 Subject: [PATCH] Customize: Allow notifications for linting errors in code editor control (for Additional CSS) to be overridden to allow saving. Implements the same override that was implemented in [41721] for the theme/plugin editors. See #41897, #41887. Fixes #42528. git-svn-id: https://develop.svn.wordpress.org/trunk@42171 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/customize-controls.js | 21 +++++++++++++++++++ .../class-wp-customize-manager.php | 12 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 4bc94ae88c..38e408ab67 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -5280,6 +5280,27 @@ codemirror: $.Deferred() } ); api.Control.prototype.initialize.call( control, id, options ); + + // Note that rendering is debounced so the props will be used when rendering happens after add event. + control.notifications.bind( 'add', function( notification ) { + + // Skip if control notification is not from setting csslint_error notification. + if ( notification.code !== control.setting.id + ':csslint_error' ) { + return; + } + + // Customize the template and behavior of csslint_error notifications. + notification.templateId = 'customize-code-editor-lint-error-notification'; + notification.render = (function( render ) { + return function() { + var li = render.call( this ); + li.find( 'input[type=checkbox]' ).on( 'click', function() { + control.setting.notifications.remove( 'csslint_error' ); + } ); + return li; + }; + })( notification.render ); + } ); }, /** diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index bb4aafb0b7..803a509bf0 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/wp-includes/class-wp-customize-manager.php @@ -4125,6 +4125,18 @@ final class WP_Customize_Manager { + +