WC_Product_Cat_Dropdown_Walker
extends Walker
in package
Product category dropdown 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.
- start_el() : 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
= 'category'
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.start_el()
Starts the list before the elements are added.
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.