WC_Product_Cat_Dropdown_Walker::display_element()publicWC 2.5.0

Traverse elements to create list from elements.

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.

Method of the class: WC_Product_Cat_Dropdown_Walker{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Product_Cat_Dropdown_Walker = new WC_Product_Cat_Dropdown_Walker();
$WC_Product_Cat_Dropdown_Walker->display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
$element(object) (required)
Data object.
$children_elements(array) (required) (passed by reference — &)
List of elements to continue traversing.
$max_depth(int) (required)
Max depth to traverse.
$depth(int) (required)
Depth of current element.
$args(array) (required)
Arguments.
$output(string) (required) (passed by reference — &)
Passed by reference. Used to append additional content.

Changelog

Since 2.5.0 Introduced.

WC_Product_Cat_Dropdown_Walker::display_element() code WC 8.7.0

public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
	if ( ! $element || ( 0 === $element->count && ! empty( $args[0]['hide_empty'] ) ) ) {
		return;
	}
	parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}