Changeset 15077 for trunk/wp-admin/includes/nav-menu.php
- Timestamp:
- 05/31/2010 03:47:53 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/nav-menu.php
r15067 r15077 201 201 202 202 /** 203 * Create HTML list of nav menu input items. 204 * 205 * @package WordPress 206 * @since 3.0.0 207 * @uses Walker_Nav_Menu 208 */ 209 class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu { 210 211 /** 212 * @see Walker::start_el() 213 * @since 3.0.0 214 * 215 * @param string $output Passed by reference. Used to append additional content. 216 * @param object $item Menu item data object. 217 * @param int $depth Depth of menu item. Used for padding. 218 * @param int $current_page Menu item ID. 219 * @param object $args 220 */ 221 function start_el(&$output, $item, $depth, $args) { 222 global $_nav_menu_placeholder; 223 224 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; 225 $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder; 226 $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0; 227 228 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; 229 230 $output .= $indent . '<li>'; 231 $output .= '<label class="menu-item-title">'; 232 $output .= '<input type="checkbox" class="menu-item-checkbox'; 233 if ( ! empty( $item->_add_to_top ) ) { 234 $output .= ' add-to-top'; 235 } 236 $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> '; 237 $output .= empty( $item->label ) ? esc_html( $item->title ) : esc_html( $item->label ); 238 $output .= '</label>'; 239 240 // Menu item hidden fields 241 $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />'; 242 $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />'; 243 $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->menu_item_parent ) .'" />'; 244 $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />'; 245 $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />'; 246 $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />'; 247 $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />'; 248 $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />'; 249 $output .= '<input type="hidden" class="menu-item-description" name="menu-item[' . $possible_object_id . '][menu-item-description]" value="'. esc_attr( $item->description ) .'" />'; 250 $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />'; 251 $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />'; 252 } 253 } 254 255 /** 203 256 * Prints the appropriate response to a menu quick search. 204 257 *
Note: See TracChangeset
for help on using the changeset viewer.