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.
Built from https://develop.svn.wordpress.org/trunk@56518


git-svn-id: http://core.svn.wordpress.org/trunk@56030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2023-09-05 20:50:24 +00:00
parent 0aa0c763e2
commit 1141b9fee2
2 changed files with 22 additions and 13 deletions

View File

@ -1291,15 +1291,21 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
}
if ( $some_pending_menu_items ) {
$result .= '<div class="notice notice-info notice-alt inline"><p>'
. __( 'Click Save Menu to make pending menu items public.' )
. '</p></div>';
$message = __( 'Click Save Menu to make pending menu items public.' );
$notice_args = array(
'type' => 'info',
'additional_classes' => array( 'notice-alt', 'inline' ),
);
$result .= wp_get_admin_notice( $message, $notice_args );
}
if ( $some_invalid_menu_items ) {
$result .= '<div class="notice notice-error notice-alt inline"><p>'
. __( 'There are some invalid menu items. Please check or delete them.' )
. '</p></div>';
$message = __( 'There are some invalid menu items. Please check or delete them.' );
$notice_args = array(
'type' => 'error',
'additional_classes' => array( 'notice-alt', 'inline' ),
);
$result .= wp_get_admin_notice( $message, $notice_args );
}
$result .= '<ul class="menu" id="menu-to-edit"> ';
@ -1480,12 +1486,15 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte
/** This action is documented in wp-includes/nav-menu.php */
do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' .
sprintf(
/* translators: %s: Nav menu title. */
__( '%s has been updated.' ),
'<strong>' . $nav_menu_selected_title . '</strong>'
) . '</p></div>';
/* translators: %s: Nav menu title. */
$message = sprintf( __( '%s has been updated.' ), '<strong>' . $nav_menu_selected_title . '</strong>' );
$notice_args = array(
'id' => 'message',
'dismissible' => true,
'additional_classes' => array( 'updated' ),
);
$messages[] = wp_get_admin_notice( $message, $notice_args );
unset( $menu_items, $unsorted_menu_items );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-alpha-56515';
$wp_version = '6.4-alpha-56518';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.