Make WordPress Core

Changeset 56518


Ignore:
Timestamp:
09/05/2023 08:48:01 PM (9 months ago)
Author:
joedolson
Message:

Administration: Use admin notice functions in nav menu admin.

Use wp_get_admin_notice and wp_admin_notice to handle settings notices on the nav menu admin screens.

Props joedolson.
See #57791.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/nav-menu.php

    r56236 r56518  
    12921292
    12931293        if ( $some_pending_menu_items ) {
    1294             $result .= '<div class="notice notice-info notice-alt inline"><p>'
    1295                 . __( 'Click Save Menu to make pending menu items public.' )
    1296                 . '</p></div>';
     1294            $message     = __( 'Click Save Menu to make pending menu items public.' );
     1295            $notice_args = array(
     1296                'type'               => 'info',
     1297                'additional_classes' => array( 'notice-alt', 'inline' ),
     1298            );
     1299            $result     .= wp_get_admin_notice( $message, $notice_args );
    12971300        }
    12981301
    12991302        if ( $some_invalid_menu_items ) {
    1300             $result .= '<div class="notice notice-error notice-alt inline"><p>'
    1301                 . __( 'There are some invalid menu items. Please check or delete them.' )
    1302                 . '</p></div>';
     1303            $message     = __( 'There are some invalid menu items. Please check or delete them.' );
     1304            $notice_args = array(
     1305                'type'               => 'error',
     1306                'additional_classes' => array( 'notice-alt', 'inline' ),
     1307            );
     1308            $result     .= wp_get_admin_notice( $message, $notice_args );
    13031309        }
    13041310
     
    14811487    do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
    14821488
    1483     $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' .
    1484         sprintf(
    1485             /* translators: %s: Nav menu title. */
    1486             __( '%s has been updated.' ),
    1487             '<strong>' . $nav_menu_selected_title . '</strong>'
    1488         ) . '</p></div>';
     1489    /* translators: %s: Nav menu title. */
     1490    $message     = sprintf( __( '%s has been updated.' ), '<strong>' . $nav_menu_selected_title . '</strong>' );
     1491    $notice_args = array(
     1492        'id'                 => 'message',
     1493        'dismissible'        => true,
     1494        'additional_classes' => array( 'updated' ),
     1495    );
     1496
     1497    $messages[] = wp_get_admin_notice( $message, $notice_args );
    14891498
    14901499    unset( $menu_items, $unsorted_menu_items );
Note: See TracChangeset for help on using the changeset viewer.