[wp-trac] [WordPress Trac] #38794: Customize: Allow panels and sections to have notifications just like controls can
WordPress Trac
noreply at wordpress.org
Tue Sep 19 05:33:15 UTC 2017
#38794: Customize: Allow panels and sections to have notifications just like
controls can
------------------------------------------------------+------------------
Reporter: westonruter | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.9
Component: Customize | Version: 4.6
Severity: normal | Resolution:
Keywords: has-patch has-screenshots needs-dev-note | Focuses:
------------------------------------------------------+------------------
Comment (by westonruter):
Handy reference to add a slew of notifications to all 4 contexts where
they can appear (global, panel, section, control):
{{{#!js
// Add global notifications.
_( [ 'none', 'error', 'warning', 'info', 'success' ] ).each( function(
type ) {
var code = 'example-' + type;
wp.customize.notifications.add( code, new
wp.customize.Notification( code, {
dismissible: true,
message: 'This is a sample ' + type + ' message.',
type: type
} ) );
} );
// Add notifications to the Widgets panel.
_( [ 'none', 'error', 'warning', 'info', 'success' ] ).each( function(
type ) {
var code = 'example-' + type;
wp.customize.panel( 'widgets' ).notifications.add( code, new
wp.customize.Notification( code, {
dismissible: true,
message: 'This is a sample ' + type + ' message.',
type: type
} ) );
} );
// Add notifications to the Site Identity section.
_( [ 'none', 'error', 'warning', 'info', 'success' ] ).each( function(
type ) {
var code = 'example-' + type;
wp.customize.section( 'title_tagline' ).notifications.add( code,
new wp.customize.Notification( code, {
dismissible: true,
message: 'This is a sample ' + type + ' message.',
type: type
} ) );
} );
// Add notifications to the site title control.
_( [ 'none', 'error', 'warning', 'info', 'success' ] ).each( function(
type ) {
var code = 'example-' + type;
wp.customize.control( 'blogname' ).notifications.add( code, new
wp.customize.Notification( code, {
dismissible: true,
message: 'This is a sample ' + type + ' message.',
type: type
} ) );
} );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38794#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list