Inline documentation for Walker_Category_Checklist.

See #23406.


git-svn-id: https://develop.svn.wordpress.org/trunk@25642 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Drew Jaynes 2013-09-28 18:07:02 +00:00
parent 67342ade09
commit 346d71fdbd

View File

@ -24,16 +24,51 @@ class Walker_Category_Checklist extends Walker {
var $tree_type = 'category';
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
/**
* Starts the list before the elements are added.
*
* @see Walker:start_lvl()
*
* @since 2.5.1
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of category. Used for tab indentation.
* @param array $args An array of arguments. @see wp_terms_checklist()
*/
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent<ul class='children'>\n";
}
/**
* Ends the list of after the elements are added.
*
* @see Walker::end_lvl()
*
* @since 2.5.1
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of category. Used for tab indentation.
* @param array $args An array of arguments. @see wp_terms_checklist()
*/
function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent</ul>\n";
}
/**
* Start the element output.
*
* @see Walker::start_el()
*
* @since 2.5.1
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $category The current term object.
* @param int $depth Depth of the term in reference to parents. Default 0.
* @param array $args An array of arguments. @see wp_terms_checklist()
* @param int $id ID of the current term.
*/
function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
extract($args);
if ( empty($taxonomy) )
@ -48,6 +83,18 @@ class Walker_Category_Checklist extends Walker {
$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
}
/**
* Ends the element output, if needed.
*
* @see Walker::end_el()
*
* @since 2.5.1
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $category The current term object.
* @param int $depth Depth of the term in reference to parents. Default 0.
* @param array $args An array of arguments. @see wp_terms_checklist()
*/
function end_el( &$output, $category, $depth = 0, $args = array() ) {
$output .= "</li>\n";
}