WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/12/2017 07:02:49 AM (2 years ago)
Author:
westonruter
Message:

Customize: Add global notifications area.

  • Displays an error notification in the global area when a save attempt is rejected due to invalid settings. An error notification is also displayed when saving fails due to a network error or server error.
  • Introduces wp.customize.Notifications subclass of wp.customize.Values to contain instances of wp.customize.Notification and manage their rendering into a container.
  • Exposes the global notification area as wp.customize.notifications collection instance.
  • Updates the notifications object on Control to use Notifications rather than Values and to re-use the rendering logic from the former. The old Control#renderNotifications method is deprecated.
  • Allows notifications to be dismissed by instantiating them with a dismissible property.
  • Allows wp.customize.Notification to be extended with custom templates and render functions.
  • Triggers a removed event on wp.customize.Values instances _after_ a value has been removed from the collection.

Props delawski, westonruter, karmatosed, celloexpressions, Fab1en, melchoyce, Kelderic, afercia, adamsilverstein.
See #34893, #39896.
Fixes #35210, #31582, #37727, #37269.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/customize.php

    r40704 r41374  
    152152
    153153        <div id="widgets-right" class="wp-clearfix"><!-- For Widget Customizer, many widgets try to look for instances under div#widgets-right, so we have to add that ID to a container div in the Customizer for compat -->
    154         <div class="wp-full-overlay-sidebar-content" tabindex="-1">
    155             <div id="customize-info" class="accordion-section customize-info">
    156                 <div class="accordion-section-title">
    157                     <span class="preview-notice"><?php
    158                         echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
    159                     ?></span>
    160                     <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
     154            <div id="customize-notifications-area" class="customize-control-notifications-container">
     155                <ul></ul>
     156            </div>
     157            <div class="wp-full-overlay-sidebar-content" tabindex="-1">
     158                <div id="customize-info" class="accordion-section customize-info">
     159                    <div class="accordion-section-title">
     160                        <span class="preview-notice"><?php
     161                            echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
     162                        ?></span>
     163                        <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
     164                    </div>
     165                    <div class="customize-panel-description"><?php
     166                        _e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements.' );
     167                    ?></div>
    161168                </div>
    162                 <div class="customize-panel-description"><?php
    163                     _e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements.' );
    164                 ?></div>
     169
     170                <div id="customize-theme-controls">
     171                    <ul class="customize-pane-parent"><?php // Panels and sections are managed here via JavaScript ?></ul>
     172                </div>
    165173            </div>
    166 
    167             <div id="customize-theme-controls">
    168                 <ul class="customize-pane-parent"><?php // Panels and sections are managed here via JavaScript ?></ul>
    169             </div>
    170         </div>
    171174        </div>
    172175
Note: See TracChangeset for help on using the changeset viewer.