WordPress at a glance
function is not described

Walker_Category_Checklist::start_el() WP 2.5.1

Start the element output.

This is a method of the class: Walker_Category_Checklist

Hooks from the method
Return

Null. Nothing.

Usage

$Walker_Category_Checklist = new Walker_Category_Checklist();
$var = $Walker_Category_Checklist->start_el( $output, $category, $depth, $args, $id );
$output(string) (required) (passed by reference — &)
Used to append additional content (passed by reference).
$category(object) (required)
The current term object.
$depth(int)
Depth of the term in reference to parents.
Default: 0
$args(array)
An array of arguments. @see wp_terms_checklist()
Default: array()
$id(int)
ID of the current term.
Default: 0

Notes

  • See: Walker::start_el()

Changelog

Since 2.5.1 Introduced.

Code of Walker Category Checklist::start el: wp-admin/includes/class-walker-category-checklist.php WP 5.2.3

<?php
public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
	if ( empty( $args['taxonomy'] ) ) {
		$taxonomy = 'category';
	} else {
		$taxonomy = $args['taxonomy'];
	}

	if ( $taxonomy == 'category' ) {
		$name = 'post_category';
	} else {
		$name = 'tax_input[' . $taxonomy . ']';
	}

	$args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
	$class                = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';

	$args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];

	if ( ! empty( $args['list_only'] ) ) {
		$aria_checked = 'false';
		$inner_class  = 'category';

		if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
			$inner_class .= ' selected';
			$aria_checked = 'true';
		}

		/** This filter is documented in wp-includes/category-template.php */
		$output .= "\n" . '<li' . $class . '>' .
			'<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
			' tabindex="0" role="checkbox" aria-checked="' . $aria_checked . '">' .
			esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</div>';
	} else {
		/** This filter is documented in wp-includes/category-template.php */
		$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, $args['selected_cats'] ), true, false ) .
			disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
			esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</label>';
	}
}