Improve inline documentation for `Walker_Nav_Menu`, `Walker_Nav_Menu_Edit`, `Walker_Nav_Menu_Checklist`.
Includes previously undocumented parameters. See #23406. Built from https://develop.svn.wordpress.org/trunk@25643 git-svn-id: http://core.svn.wordpress.org/trunk@25560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
858343ed71
commit
39d7e0df8a
|
@ -9,29 +9,42 @@
|
||||||
*/
|
*/
|
||||||
class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
||||||
/**
|
/**
|
||||||
|
* Starts the list before the elements are added.
|
||||||
|
*
|
||||||
* @see Walker_Nav_Menu::start_lvl()
|
* @see Walker_Nav_Menu::start_lvl()
|
||||||
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param string $output Passed by reference.
|
* @param string $output Passed by reference.
|
||||||
|
* @param int $depth Depth of menu item. Used for padding.
|
||||||
|
* @param array $args Not used.
|
||||||
*/
|
*/
|
||||||
function start_lvl( &$output, $depth = 0, $args = array() ) {}
|
function start_lvl( &$output, $depth = 0, $args = array() ) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Ends the list of after the elements are added.
|
||||||
|
*
|
||||||
* @see Walker_Nav_Menu::end_lvl()
|
* @see Walker_Nav_Menu::end_lvl()
|
||||||
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param string $output Passed by reference.
|
* @param string $output Passed by reference.
|
||||||
|
* @param int $depth Depth of menu item. Used for padding.
|
||||||
|
* @param array $args Not used.
|
||||||
*/
|
*/
|
||||||
function end_lvl( &$output, $depth = 0, $args = array() ) {}
|
function end_lvl( &$output, $depth = 0, $args = array() ) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Walker::start_el()
|
* Start the element output.
|
||||||
|
*
|
||||||
|
* @see Walker_Nav_Menu::start_el()
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param string $output Passed by reference. Used to append additional content.
|
* @param string $output Passed by reference. Used to append additional content.
|
||||||
* @param object $item Menu item data object.
|
* @param object $item Menu item data object.
|
||||||
* @param int $depth Depth of menu item. Used for padding.
|
* @param int $depth Depth of menu item. Used for padding.
|
||||||
* @param object $args
|
* @param array $args Not used.
|
||||||
|
* @param int $id Not used.
|
||||||
*/
|
*/
|
||||||
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
||||||
global $_wp_nav_menu_max_depth;
|
global $_wp_nav_menu_max_depth;
|
||||||
|
@ -212,7 +225,8 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
||||||
<?php
|
<?php
|
||||||
$output .= ob_get_clean();
|
$output .= ob_get_clean();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} // Walker_Nav_Menu_Edit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create HTML list of nav menu input items.
|
* Create HTML list of nav menu input items.
|
||||||
|
@ -228,24 +242,50 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts the list before the elements are added.
|
||||||
|
*
|
||||||
|
* @see Walker_Nav_Menu::start_lvl()
|
||||||
|
*
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param string $output Passed by reference. Used to append additional content.
|
||||||
|
* @param int $depth Depth of page. Used for padding.
|
||||||
|
* @param array $args Not used.
|
||||||
|
*/
|
||||||
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
||||||
$indent = str_repeat( "\t", $depth );
|
$indent = str_repeat( "\t", $depth );
|
||||||
$output .= "\n$indent<ul class='children'>\n";
|
$output .= "\n$indent<ul class='children'>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ends the list of after the elements are added.
|
||||||
|
*
|
||||||
|
* @see Walker_Nav_Menu::end_lvl()
|
||||||
|
*
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param string $output Passed by reference. Used to append additional content.
|
||||||
|
* @param int $depth Depth of page. Used for padding.
|
||||||
|
* @param array $args Not used.
|
||||||
|
*/
|
||||||
function end_lvl( &$output, $depth = 0, $args = array() ) {
|
function end_lvl( &$output, $depth = 0, $args = array() ) {
|
||||||
$indent = str_repeat( "\t", $depth );
|
$indent = str_repeat( "\t", $depth );
|
||||||
$output .= "\n$indent</ul>";
|
$output .= "\n$indent</ul>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Walker::start_el()
|
* Start the element output.
|
||||||
|
*
|
||||||
|
* @see Walker_Nav_Menu::start_el()
|
||||||
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param string $output Passed by reference. Used to append additional content.
|
* @param string $output Passed by reference. Used to append additional content.
|
||||||
* @param object $item Menu item data object.
|
* @param object $item Menu item data object.
|
||||||
* @param int $depth Depth of menu item. Used for padding.
|
* @param int $depth Depth of menu item. Used for padding.
|
||||||
* @param object $args
|
* @param array $args Not used.
|
||||||
|
* @param int $id Not used.
|
||||||
*/
|
*/
|
||||||
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
||||||
global $_nav_menu_placeholder;
|
global $_nav_menu_placeholder;
|
||||||
|
@ -284,7 +324,8 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
|
||||||
$output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />';
|
$output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />';
|
||||||
$output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';
|
$output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} // Walker_Nav_Menu_Checklist
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints the appropriate response to a menu quick search.
|
* Prints the appropriate response to a menu quick search.
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
class Walker_Nav_Menu extends Walker {
|
class Walker_Nav_Menu extends Walker {
|
||||||
/**
|
/**
|
||||||
|
* What the class handles.
|
||||||
|
*
|
||||||
* @see Walker::$tree_type
|
* @see Walker::$tree_type
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -23,6 +25,8 @@ class Walker_Nav_Menu extends Walker {
|
||||||
var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
|
var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Database fields to use.
|
||||||
|
*
|
||||||
* @see Walker::$db_fields
|
* @see Walker::$db_fields
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @todo Decouple this.
|
* @todo Decouple this.
|
||||||
|
@ -31,11 +35,15 @@ class Walker_Nav_Menu extends Walker {
|
||||||
var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
|
var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Starts the list before the elements are added.
|
||||||
|
*
|
||||||
* @see Walker::start_lvl()
|
* @see Walker::start_lvl()
|
||||||
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param string $output Passed by reference. Used to append additional content.
|
* @param string $output Passed by reference. Used to append additional content.
|
||||||
* @param int $depth Depth of page. Used for padding.
|
* @param int $depth Depth of menu item. Used for padding.
|
||||||
|
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||||
*/
|
*/
|
||||||
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
||||||
$indent = str_repeat("\t", $depth);
|
$indent = str_repeat("\t", $depth);
|
||||||
|
@ -43,11 +51,15 @@ class Walker_Nav_Menu extends Walker {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Ends the list of after the elements are added.
|
||||||
|
*
|
||||||
* @see Walker::end_lvl()
|
* @see Walker::end_lvl()
|
||||||
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param string $output Passed by reference. Used to append additional content.
|
* @param string $output Passed by reference. Used to append additional content.
|
||||||
* @param int $depth Depth of page. Used for padding.
|
* @param int $depth Depth of menu item. Used for padding.
|
||||||
|
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||||
*/
|
*/
|
||||||
function end_lvl( &$output, $depth = 0, $args = array() ) {
|
function end_lvl( &$output, $depth = 0, $args = array() ) {
|
||||||
$indent = str_repeat("\t", $depth);
|
$indent = str_repeat("\t", $depth);
|
||||||
|
@ -55,14 +67,17 @@ class Walker_Nav_Menu extends Walker {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Start the element output.
|
||||||
|
*
|
||||||
* @see Walker::start_el()
|
* @see Walker::start_el()
|
||||||
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param string $output Passed by reference. Used to append additional content.
|
* @param string $output Passed by reference. Used to append additional content.
|
||||||
* @param object $item Menu item data object.
|
* @param object $item Menu item data object.
|
||||||
* @param int $depth Depth of menu item. Used for padding.
|
* @param int $depth Depth of menu item. Used for padding.
|
||||||
* @param int $current_page Menu item ID.
|
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||||
* @param object $args
|
* @param int $id Current item ID.
|
||||||
*/
|
*/
|
||||||
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
||||||
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
||||||
|
@ -77,9 +92,9 @@ class Walker_Nav_Menu extends Walker {
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param array $classes The CSS classes that are applied to the menu item's <li>.
|
* @param array $classes The CSS classes that are applied to the menu item's <li>.
|
||||||
* @param object $item The current menu item.
|
* @param object $item The current menu item.
|
||||||
* @param array $args Arguments from {@see wp_nav_menu()}.
|
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||||
*/
|
*/
|
||||||
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
|
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
|
||||||
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
||||||
|
@ -91,7 +106,7 @@ class Walker_Nav_Menu extends Walker {
|
||||||
*
|
*
|
||||||
* @param string The ID that is applied to the menu item's <li>.
|
* @param string The ID that is applied to the menu item's <li>.
|
||||||
* @param object $item The current menu item.
|
* @param object $item The current menu item.
|
||||||
* @param array $args Arguments from {@see wp_nav_menu()}.
|
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||||
*/
|
*/
|
||||||
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
|
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
|
||||||
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
|
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
|
||||||
|
@ -112,13 +127,13 @@ class Walker_Nav_Menu extends Walker {
|
||||||
* @param array $atts {
|
* @param array $atts {
|
||||||
* The HTML attributes applied to the menu item's <a>, empty strings are ignored.
|
* The HTML attributes applied to the menu item's <a>, empty strings are ignored.
|
||||||
*
|
*
|
||||||
* @type string $title The title attribute.
|
* @type string $title The title attribute.
|
||||||
* @type string $target The target attribute.
|
* @type string $target The target attribute.
|
||||||
* @type string $rel The rel attribute.
|
* @type string $rel The rel attribute.
|
||||||
* @type string $href The href attribute.
|
* @type string $href The href attribute.
|
||||||
* }
|
* }
|
||||||
* @param object $item The current menu item.
|
* @param object $item The current menu item.
|
||||||
* @param array $args Arguments from {@see wp_nav_menu()}.
|
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||||
*/
|
*/
|
||||||
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
|
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
|
||||||
|
|
||||||
|
@ -146,26 +161,31 @@ class Walker_Nav_Menu extends Walker {
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param string The menu item's starting HTML output.
|
* @param string $item_output The menu item's starting HTML output.
|
||||||
* @param object $item The current menu item.
|
* @param object $item Menu item data object.
|
||||||
* @param int $depth From {@see Walker_Nav_Menu::start_el}.
|
* @param int $depth Depth of menu item. Used for padding.
|
||||||
* @param array $args Arguments from {@see wp_nav_menu()}.
|
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||||
*/
|
*/
|
||||||
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
|
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Ends the element output, if needed.
|
||||||
|
*
|
||||||
* @see Walker::end_el()
|
* @see Walker::end_el()
|
||||||
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param string $output Passed by reference. Used to append additional content.
|
* @param string $output Passed by reference. Used to append additional content.
|
||||||
* @param object $item Page data object. Not used.
|
* @param object $item Page data object. Not used.
|
||||||
* @param int $depth Depth of page. Not Used.
|
* @param int $depth Depth of page. Not Used.
|
||||||
|
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||||
*/
|
*/
|
||||||
function end_el( &$output, $item, $depth = 0, $args = array() ) {
|
function end_el( &$output, $item, $depth = 0, $args = array() ) {
|
||||||
$output .= "</li>\n";
|
$output .= "</li>\n";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} // Walker_Nav_Menu
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a navigation menu.
|
* Displays a navigation menu.
|
||||||
|
|
Loading…
Reference in New Issue