WC_Product_Cat_List_Walker
extends Walker
in package
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
$db_fields
DB fields to use.
public
array<string|int, mixed>
$db_fields
= array('parent' => 'parent', 'id' => 'term_id', 'slug' => 'slug')
$tree_type
What the class handles.
public
string
$tree_type
= 'product_cat'
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
Return values
null — Null 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
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
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
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'.