Make WordPress Core


Ignore:
Timestamp:
09/14/2023 12:52:45 AM (15 months ago)
Author:
joedolson
Message:

Administration: Use wp_admin_notice() in /wp-admin/.

Add usages of wp_admin_notice() and wp_get_admin_notice() on .notice-[type] in the root level of /wp-admin/. Ongoing task to implement new function across core.

Props costdev, joedolson.
See #57791.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-blocks.php

    r56559 r56570  
    320320    <div class="wrap hide-if-js block-editor-no-js">
    321321        <h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
    322         <div class="notice notice-error">
    323             <p>
    324                 <?php
    325                     $message = sprintf(
    326                         /* translators: %s: A link to install the Classic Editor plugin. */
    327                         __( 'The block editor requires JavaScript. Please enable JavaScript in your browser settings, or try the <a href="%s">Classic Editor plugin</a>.' ),
    328                         esc_url( wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ), 'save_wporg_username_' . get_current_user_id() ) )
    329                     );
    330 
    331                     /**
    332                      * Filters the message displayed in the block editor interface when JavaScript is
    333                      * not enabled in the browser.
    334                      *
    335                      * @since 5.0.3
    336                      *
    337                      * @param string  $message The message being displayed.
    338                      * @param WP_Post $post    The post being edited.
    339                      */
    340                     echo apply_filters( 'block_editor_no_javascript_message', $message, $post );
    341                     ?>
    342             </p>
    343         </div>
     322        <?php
     323        $message = sprintf(
     324            /* translators: %s: A link to install the Classic Editor plugin. */
     325            __( 'The block editor requires JavaScript. Please enable JavaScript in your browser settings, or try the <a href="%s">Classic Editor plugin</a>.' ),
     326            esc_url( wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ), 'save_wporg_username_' . get_current_user_id() ) )
     327        );
     328
     329        /**
     330         * Filters the message displayed in the block editor interface when JavaScript is
     331         * not enabled in the browser.
     332         *
     333         * @since 5.0.3
     334         *
     335         * @param string  $message The message being displayed.
     336         * @param WP_Post $post    The post being edited.
     337         */
     338        $message = apply_filters( 'block_editor_no_javascript_message', $message, $post );
     339        wp_admin_notice(
     340            $message,
     341            array(
     342                'type' => 'error',
     343            )
     344        );
     345        ?>
    344346    </div>
    345347</div>
Note: See TracChangeset for help on using the changeset viewer.