From 15a1a43cd1f6f19f2d06455dbd1218a268e84a92 Mon Sep 17 00:00:00 2001 From: nacin Date: Thu, 27 May 2010 22:22:09 +0000 Subject: [PATCH] New pending menu item behavior. props filosofo, see #13579. git-svn-id: http://svn.automattic.com/wordpress/trunk@15008 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-ajax.php | 11 ++----- wp-admin/includes/nav-menu.php | 54 ++++++++++++++++++++++++++++++---- wp-admin/nav-menus.php | 18 ++++++------ wp-includes/nav-menu.php | 38 +++++++++++++++++------- 4 files changed, 88 insertions(+), 33 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 954eae3b3c..09cc4e3945 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -816,14 +816,9 @@ case 'add-menu-item' : require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; - $menu_id = (int) $_POST['menu']; - if ( isset( $_POST['menu-item'] ) ) { - $item_ids = wp_save_nav_menu_items( $menu_id, $_POST['menu-item'] ); - if ( is_wp_error( $item_ids ) ) - die('-1'); - } else { - $item_ids = array(); - } + $item_ids = wp_save_nav_menu_items( 0, $_POST['menu-item'] ); + if ( is_wp_error( $item_ids ) ) + die('-1'); foreach ( (array) $item_ids as $menu_item_id ) { $menu_obj = get_post( $menu_item_id ); diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index bff7e368d7..6fbf9eb56a 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -58,11 +58,26 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { $original_object = get_post( $item->object_id ); $original_title = $original_object->post_title; } + + $classes = array( + 'menu-item menu-item-depth-' . $depth, + 'menu-item-' . esc_attr( $item->object ), + 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'), + ); + + $title = $item->title; + + if ( isset( $item->post_status ) && 'draft' == $item->post_status ) { + $classes[] = 'pending'; + /* translators: %s: title of menu item in draft status */ + $title = sprintf( __('%s (Pending)'), $item->title ); + } + ?> -