WooCommerce Code Reference

WC_Product_Cat_List_Walker extends Walker

Product cat list walker class.

Table of Contents

$db_fields  : array<string|int, mixed>
DB fields to use.
$tree_type  : string
What the class handles.
display_element()  : null
Traverse elements to create list from elements.
end_el()  : mixed
Ends the element output, if needed.
end_lvl()  : mixed
Ends the list of after the elements are added.
start_el()  : mixed
Start the element output.
start_lvl()  : mixed
Starts the list before the elements are added.

Properties

Methods

display_element()

Traverse elements to create list from elements.

public display_element(object $element, array<string|int, mixed> &$children_elements, int $max_depth, int $depth, array<string|int, mixed> $args, string &$output) : null

Display one element if the element doesn't have any children otherwise, display the element and its children. Will only traverse up to the max. depth and no ignore elements under that depth. It is possible to set the. max depth to include all depths, see walk() method.

This method shouldn't be called directly, use the walk() method instead.

Parameters
$element : object

Data object.

$children_elements : array<string|int, mixed>

List of elements to continue traversing.

$max_depth : int

Max depth to traverse.

$depth : int

Depth of current element.

$args : array<string|int, mixed>

Arguments.

$output : string

Passed by reference. Used to append additional content.

Tags
since
2.5.0
Return values
nullNull on failure with no changes to parameters.

end_el()

Ends the element output, if needed.

public end_el(string &$output, object $cat, int $depth[, array<string|int, mixed> $args = array() ]) : mixed
Parameters
$output : string

Passed by reference. Used to append additional content.

$cat : object

Category.

$depth : int

Depth of category. Not used.

$args : array<string|int, mixed> = array()

Only uses 'list' for whether should append to output.

Tags
see
Walker::end_el()
since
2.1.0
Return values
mixed

end_lvl()

Ends the list of after the elements are added.

public end_lvl(string &$output, int $depth[, array<string|int, mixed> $args = array() ]) : mixed
Parameters
$output : string

Passed by reference. Used to append additional content.

$depth : int

Depth of category. Used for tab indentation.

$args : array<string|int, mixed> = array()

Will only append content if style argument value is 'list'.

Tags
see
Walker::end_lvl()
since
2.1.0
Return values
mixed

start_el()

Start the element output.

public start_el(string &$output, object $cat, int $depth[, array<string|int, mixed> $args = array() ], int $current_object_id) : mixed
Parameters
$output : string

Passed by reference. Used to append additional content.

$cat : object

Category.

$depth : int

Depth of category in reference to parents.

$args : array<string|int, mixed> = array()

Arguments.

$current_object_id : int

Current object ID.

Tags
see
Walker::start_el()
since
2.1.0
Return values
mixed

start_lvl()

Starts the list before the elements are added.

public start_lvl(string &$output, int $depth[, array<string|int, mixed> $args = array() ]) : mixed
Parameters
$output : string

Passed by reference. Used to append additional content.

$depth : int

Depth of category. Used for tab indentation.

$args : array<string|int, mixed> = array()

Will only append content if style argument value is 'list'.

Tags
see
Walker::start_lvl()
since
2.1.0
Return values
mixed