#38794 closed enhancement (fixed)
Customize: Allow panels and sections to have notifications just like controls can
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.9 | Priority: | normal |
| Severity: | normal | Version: | 4.6 |
| Component: | Customize | Keywords: | has-patch has-screenshots has-dev-note |
| Focuses: | Cc: |
Description (last modified by westonruter)
In #34893, the ability to show notifications on controls was added. In #35210 this is proposed to be extended at a global level to be able to show notifications at the root of the customizer. Between these two ends, there should also be the ability to show notifications at the panel and section level.
The Customize Posts plugin implements notifications for sections which could serve as a start for the patch here: https://github.com/xwp/wp-customize-posts/blob/0.8.2/js/customize-post-section.js#L825-L942
Once implemented, section notifications should be utilized for the Header Media section to show a notification when not previewing a URL that is eligible for a header video. See #38778. The section-level notification could be used in #40432 as well.
For more sample code, see:
- https://github.com/xwp/wp-customize-featured-content-demo/blob/8bf4d65/js/featured-items-panel.js#L45
- https://github.com/xwp/wp-customize-featured-content-demo/blob/8bf4d65/js/featured-items-panel.js#L69-L116
- https://github.com/xwp/wp-customize-featured-content-demo/blob/c748adf/php/class-featured-items-customize-panel.php#L47-L63
Attachments (5)
Change History (16)
#1
@celloexpressions
10 months ago
- Version set to 4.6
#2
@westonruter
9 months ago
- Description modified (diff)
#3
@westonruter
7 months ago
- Description modified (diff)
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
7 months ago
#5
@jbpaul17
6 months ago
- Milestone changed from 4.8 to 4.8.1
Punting to 4.8.1 per bug scrub earlier this week.
#6
@westonruter
6 months ago
- Milestone changed from 4.8.1 to 4.9
@westonruter
2 months ago
@westonruter
2 months ago
@westonruter
2 months ago
@westonruter
2 months ago
#7
@westonruter
2 months ago
- Keywords has-patch has-screenshots needs-dev-note added; needs-patch removed
#8
@westonruter
2 months ago
Handy reference to add a slew of notifications to all 4 contexts where they can appear (global, panel, section, control):
// 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 } ) ); } );
#9
@westonruter
2 months ago
- Owner set to westonruter
- Resolution set to fixed
- Status changed from new to closed
In 41390:
#10
@westonruter
4 weeks ago
In 42031:
#11
@westonruter
3 weeks ago
- Keywords has-dev-note added; needs-dev-note removed
While it's probably generally a better practice to use control-specific descriptions and notifications, header media is a good example of where it can make sense to do this for certain sections and panels. Another potential use case could be an info notification in the menus panel when there are no menus that invites users to create their first menu and assign it to their theme's locations.