ArrayBrowser

Class for displaying an array as a tree which can collapse / expand.

See the extension 'lowlevel' / config (Backend module 'Tools > Configuration')

Internal

just a helper class for internal usage.

Table of Contents

Properties

$depthKeys  : array<string|int, mixed>
If set, the variable keys are not linked.
$expAll  : bool
$regexMode  : bool
If set, the values are truncated with "..." appended if longer than a certain length.
$searchKeys  : array<string|int, mixed>
Array defining which keys to expand. Typically set from outside from some session variable - otherwise the array will collapse.
$searchKeysToo  : bool
If set, search for string with regex, otherwise stristr()
$route  : Route|null
If null then there are no links set.
$uriBuilder  : UriBuilder

Methods

__construct()  : mixed
depthKeys()  : array<string|int, mixed>
Function modifying the depthKey array
getSearchKeys()  : array<string|int, mixed>
Creates an array with "depthKeys" which will expand the array to show the search results
tree()  : string
Set var name here if you want links to the variable name.

Properties

$depthKeys

If set, the variable keys are not linked.

public array<string|int, mixed> $depthKeys = []

$regexMode

If set, the values are truncated with "..." appended if longer than a certain length.

public bool $regexMode = false

$searchKeys

Array defining which keys to expand. Typically set from outside from some session variable - otherwise the array will collapse.

public array<string|int, mixed> $searchKeys = []

$searchKeysToo

If set, search for string with regex, otherwise stristr()

public bool $searchKeysToo = true

$route

If null then there are no links set.

protected Route|null $route

Methods

__construct()

public __construct([Route|null $route = null ]) : mixed
Parameters
$route : Route|null = null

depthKeys()

Function modifying the depthKey array

public depthKeys(array<string|int, mixed> $arr, array<string|int, mixed> $settings) : array<string|int, mixed>
Parameters
$arr : array<string|int, mixed>

Array with instructions to open/close nodes.

$settings : array<string|int, mixed>

Input depth_key array

Return values
array<string|int, mixed>

Output depth_key array with entries added/removed based on $arr

getSearchKeys()

Creates an array with "depthKeys" which will expand the array to show the search results

public getSearchKeys(array<string|int, mixed> $keyArr, string $depth_in, string $searchString, array<string|int, mixed> $keyArray) : array<string|int, mixed>
Parameters
$keyArr : array<string|int, mixed>

The array to search for the value

$depth_in : string

Depth string - blank for first call (will build up during recursive calling creating an id of the position: [key1].[key2].[key3]

$searchString : string

The string to search for

$keyArray : array<string|int, mixed>

Key array, for first call pass empty array

Return values
array<string|int, mixed>

tree()

Set var name here if you want links to the variable name.

public tree(array<string|int, mixed> $array, string $positionKey) : string

Make browsable tree Before calling this function you may want to set some of the internal vars like depthKeys and regexMode.

Parameters
$array : array<string|int, mixed>

The array to display

$positionKey : string

Key-position id. Build up during recursive calls - [key1].[key2].[key3] - and so on.

Return values
string

HTML for the tree


        
On this page

Search results