From 78d93bfac389a9858d88dc47b92dd6dcebad50a0 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Sat, 28 Sep 2013 21:01:54 +0000 Subject: [PATCH] Improve inline documentation for `Walker_Nav_Menu`, `Walker_Nav_Menu_Edit`, `Walker_Nav_Menu_Checklist`. Includes previously undocumented parameters. See #23406. git-svn-id: https://develop.svn.wordpress.org/trunk@25643 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/nav-menu.php | 61 +++++++++++++++++++++----- src/wp-includes/nav-menu-template.php | 62 ++++++++++++++++++--------- 2 files changed, 92 insertions(+), 31 deletions(-) diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php index 65c988a441..b66bf598e8 100644 --- a/src/wp-admin/includes/nav-menu.php +++ b/src/wp-admin/includes/nav-menu.php @@ -9,29 +9,42 @@ */ class Walker_Nav_Menu_Edit 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. + * @param int $depth Depth of menu item. Used for padding. + * @param array $args Not used. */ function start_lvl( &$output, $depth = 0, $args = array() ) {} /** + * 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. + * @param int $depth Depth of menu item. Used for padding. + * @param array $args Not used. */ 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 * * @param string $output Passed by reference. Used to append additional content. - * @param object $item Menu item data object. - * @param int $depth Depth of menu item. Used for padding. - * @param object $args + * @param object $item Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param array $args Not used. + * @param int $id Not used. */ function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $_wp_nav_menu_max_depth; @@ -212,7 +225,8 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { \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() ) { $indent = str_repeat( "\t", $depth ); $output .= "\n$indent"; } /** - * @see Walker::start_el() + * Start the element output. + * + * @see Walker_Nav_Menu::start_el() + * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. - * @param object $item Menu item data object. - * @param int $depth Depth of menu item. Used for padding. - * @param object $args + * @param object $item Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param array $args Not used. + * @param int $id Not used. */ function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $_nav_menu_placeholder; @@ -284,7 +324,8 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu { $output .= ''; $output .= ''; } -} + +} // Walker_Nav_Menu_Checklist /** * Prints the appropriate response to a menu quick search. diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php index 52a6e0f64b..821fdde40f 100644 --- a/src/wp-includes/nav-menu-template.php +++ b/src/wp-includes/nav-menu-template.php @@ -16,6 +16,8 @@ */ class Walker_Nav_Menu extends Walker { /** + * What the class handles. + * * @see Walker::$tree_type * @since 3.0.0 * @var string @@ -23,6 +25,8 @@ class Walker_Nav_Menu extends Walker { var $tree_type = array( 'post_type', 'taxonomy', 'custom' ); /** + * Database fields to use. + * * @see Walker::$db_fields * @since 3.0.0 * @todo Decouple this. @@ -31,11 +35,15 @@ class Walker_Nav_Menu extends Walker { var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' ); /** + * Starts the list before the elements are added. + * * @see Walker::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 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() ) { $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() + * * @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 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() ) { $indent = str_repeat("\t", $depth); @@ -55,14 +67,17 @@ class Walker_Nav_Menu extends Walker { } /** + * Start the element output. + * * @see Walker::start_el() + * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. - * @param object $item Menu item data object. - * @param int $depth Depth of menu item. Used for padding. - * @param int $current_page Menu item ID. - * @param object $args + * @param object $item Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param array $args An array of arguments. @see wp_nav_menu() + * @param int $id Current item ID. */ function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; @@ -77,9 +92,9 @@ class Walker_Nav_Menu extends Walker { * * @since 3.0.0 * - * @param array $classes The CSS classes that are applied to the menu item's
  • . - * @param object $item The current menu item. - * @param array $args Arguments from {@see wp_nav_menu()}. + * @param array $classes The CSS classes that are applied to the menu item's
  • . + * @param object $item The current menu item. + * @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 = $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
  • . * @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 = $id ? ' id="' . esc_attr( $id ) . '"' : ''; @@ -112,13 +127,13 @@ class Walker_Nav_Menu extends Walker { * @param array $atts { * The HTML attributes applied to the menu item's , empty strings are ignored. * - * @type string $title The title attribute. + * @type string $title The title attribute. * @type string $target The target attribute. - * @type string $rel The rel attribute. - * @type string $href The href attribute. + * @type string $rel The rel attribute. + * @type string $href The href attribute. * } * @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 ); @@ -146,26 +161,31 @@ class Walker_Nav_Menu extends Walker { * * @since 3.0.0 * - * @param string The menu item's starting HTML output. - * @param object $item The current menu item. - * @param int $depth From {@see Walker_Nav_Menu::start_el}. - * @param array $args Arguments from {@see wp_nav_menu()}. + * @param string $item_output The menu item's starting HTML output. + * @param object $item Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param array $args An array of arguments. @see wp_nav_menu() */ $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } /** + * Ends the element output, if needed. + * * @see Walker::end_el() + * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. - * @param object $item Page data object. Not used. - * @param int $depth Depth of page. Not Used. + * @param object $item Page data object. 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() ) { $output .= "
  • \n"; } -} + +} // Walker_Nav_Menu /** * Displays a navigation menu.