[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> class-wp-walker.php (summary)

(no description)

File Size: 443 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Walker:: (9 methods):
  start_lvl()
  end_lvl()
  start_el()
  end_el()
  display_element()
  walk()
  paged_walk()
  get_number_of_root_elements()
  unset_children()


Class: Walker  - X-Ref

A class for displaying various tree-like structures.

Extend the Walker class to use it, see examples below. Child classes
do not need to implement all of the abstract methods in the class. The child
only needs to implement the methods that are needed.

start_lvl( &$output, $depth = 0, $args = array()   X-Ref
Starts the list before the elements are added.

The $args parameter holds additional values that may be used with the child
class methods. This method is called at the start of the output list.

param: string $output Used to append additional content (passed by reference).
param: int    $depth  Depth of the item.
param: array  $args   An array of additional arguments.
since: 2.1.0

end_lvl( &$output, $depth = 0, $args = array()   X-Ref
Ends the list of after the elements are added.

The $args parameter holds additional values that may be used with the child
class methods. This method finishes the list at the end of output of the elements.

param: string $output Used to append additional content (passed by reference).
param: int    $depth  Depth of the item.
param: array  $args   An array of additional arguments.
since: 2.1.0

start_el( &$output, $object, $depth = 0, $args = array()   X-Ref
Start the element output.

The $args parameter holds additional values that may be used with the child
class methods. Includes the element output also.

param: string $output            Used to append additional content (passed by reference).
param: object $object            The data object.
param: int    $depth             Depth of the item.
param: array  $args              An array of additional arguments.
param: int    $current_object_id ID of the current item.
since: 2.1.0

end_el( &$output, $object, $depth = 0, $args = array()   X-Ref
Ends the element output, if needed.

The $args parameter holds additional values that may be used with the child class methods.

param: string $output Used to append additional content (passed by reference).
param: object $object The data object.
param: int    $depth  Depth of the item.
param: array  $args   An array of additional arguments.
since: 2.1.0

display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output )   X-Ref
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 should not be called directly, use the walk() method instead.

param: object $element           Data object.
param: array  $children_elements List of elements to continue traversing (passed by reference).
param: int    $max_depth         Max depth to traverse.
param: int    $depth             Depth of current element.
param: array  $args              An array of arguments.
param: string $output            Used to append additional content (passed by reference).
since: 2.5.0

walk( $elements, $max_depth )   X-Ref
Display array of elements hierarchically.

Does not assume any existing order of elements.

$max_depth = -1 means flatly display every element.
$max_depth = 0 means display all levels.
$max_depth > 0 specifies the number of display levels.

return: string The hierarchical item output.
param: array $elements  An array of elements.
param: int   $max_depth The maximum hierarchical depth.
since: 2.1.0

paged_walk( $elements, $max_depth, $page_num, $per_page )   X-Ref
paged_walk() - produce a page of nested elements

Given an array of hierarchical elements, the maximum depth, a specific page number,
and number of elements per page, this function first determines all top level root elements
belonging to that page, then lists them and all of their children in hierarchical order.

$max_depth = 0 means display all levels.
$max_depth > 0 specifies the number of display levels.

return: string XHTML of the specified page of elements
param: array $elements
param: int   $max_depth The maximum hierarchical depth.
param: int   $page_num The specific page number, beginning with 1.
param: int   $per_page
since: 2.7.0

get_number_of_root_elements( $elements )   X-Ref
Calculates the total number of root elements.

return: int Number of root elements.
param: array $elements Elements to list.
since: 2.7.0

unset_children( $e, &$children_elements )   X-Ref
Unset all the children for a given top level element.

param: object $e
param: array $children_elements
since: 2.7.0



Generated: Sat Sep 21 01:00:03 2019 Cross-referenced by PHPXref 0.7.1