[ Index ]

PHP Cross Reference of WordPress




/wp-includes/ -> class-wp-list-util.php (summary)

WordPress List utility class

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

Defines 1 class

WP_List_Util:: (7 methods):

Class: WP_List_Util  - X-Ref

List utility.

Utility class to handle operations on an array of objects.

__construct( $input )   X-Ref

Sets the input array.

since: 4.7.0
param: array $input Array to perform operations on.

get_input()   X-Ref
Returns the original input array.

since: 4.7.0
return: array The input array.

get_output()   X-Ref
Returns the output array.

since: 4.7.0
return: array The output array.

filter( $args = array()   X-Ref
Filters the list, based on a set of key => value arguments.

since: 4.7.0
return: array Array of found values.
param: array  $args     Optional. An array of key => value arguments to match
param: string $operator Optional. The logical operation to perform. 'AND' means

pluck( $field, $index_key = null )   X-Ref
Plucks a certain field out of each object in the list.

This has the same functionality and prototype of
array_column() (PHP 5.5) but also supports objects.

since: 4.7.0
return: array Array of found values. If `$index_key` is set, an array of found values with keys
param: int|string $field     Field from the object to place instead of the entire object
param: int|string $index_key Optional. Field from the object to use as keys for the new array.

sort( $orderby = array()   X-Ref
Sorts the list, based on one or more orderby arguments.

since: 4.7.0
return: array The sorted array.
param: string|array $orderby       Optional. Either the field name to order by or an array
param: string       $order         Optional. Either 'ASC' or 'DESC'. Only used if $orderby
param: bool         $preserve_keys Optional. Whether to preserve keys. Default false.

sort_callback( $a, $b )   X-Ref
Callback to sort the list by specific fields.

since: 4.7.0
return: int 0 if both objects equal. -1 if second object should come first, 1 otherwise.
param: object|array $a One object to compare.
param: object|array $b The other object to compare.

Generated: Thu May 13 01:00:05 2021 Cross-referenced by PHPXref 0.7.1