[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

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

(no description)

File Size: 447 lines (13 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.

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.

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.

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.

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).

walk( $elements, $max_depth, ...$args )   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.

param: array $elements  An array of elements.
param: int   $max_depth The maximum hierarchical depth.
param: mixed ...$args   Optional additional arguments.
return: string The hierarchical item output.

paged_walk( $elements, $max_depth, $page_num, $per_page, ...$args )   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.

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
param: mixed ...$args   Optional additional arguments.
return: string XHTML of the specified page of elements

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

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

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

param: object $e
param: array $children_elements



Generated: Sat Nov 23 20:47:33 2019 Cross-referenced by PHPXref 0.7