Changeset 15077 for trunk/wp-includes/nav-menu-template.php
- Timestamp:
- 05/31/2010 03:47:53 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/nav-menu-template.php
r15075 r15077 129 129 130 130 /** 131 * Create HTML list of nav menu input items.132 *133 * @package WordPress134 * @since 3.0.0135 * @uses Walker_Nav_Menu136 */137 class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {138 139 /**140 * @see Walker::start_el()141 * @since 3.0.0142 *143 * @param string $output Passed by reference. Used to append additional content.144 * @param object $item Menu item data object.145 * @param int $depth Depth of menu item. Used for padding.146 * @param int $current_page Menu item ID.147 * @param object $args148 */149 function start_el(&$output, $item, $depth, $args) {150 global $_nav_menu_placeholder;151 152 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;153 $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;154 $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;155 156 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';157 158 $output .= $indent . '<li>';159 $output .= '<label class="menu-item-title">';160 $output .= '<input type="checkbox" class="menu-item-checkbox';161 if ( ! empty( $item->_add_to_top ) ) {162 $output .= ' add-to-top';163 }164 $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';165 $output .= empty( $item->label ) ? esc_html( $item->title ) : esc_html( $item->label );166 $output .= '</label>';167 168 // Menu item hidden fields169 $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';170 $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />';171 $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 ) .'" />';172 $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />';173 $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />';174 $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />';175 $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />';176 $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 ) .'" />';177 $output .= '<input type="hidden" class="menu-item-description" name="menu-item[' . $possible_object_id . '][menu-item-description]" value="'. esc_attr( $item->description ) .'" />';178 $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />';179 $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';180 }181 }182 183 /**184 131 * Displays a navigation menu. 185 132 *
Note: See TracChangeset
for help on using the changeset viewer.