method tree documentation in bbn\Appui\Option
Returns a simple hierarchical structure with just text, id and items
Example
X::dump($opt->tree(12));
/*
array [
['id' => 1, 'text' => 'Hello', 'items' => [
['id' => 7, 'text' => 'Hello from inside'],
['id' => 8, 'text' => 'Hello 2 from inside']
],
[
['id' => 1, 'text' => 'World']
]
function($code = NULL)
{
$id = $this->fromCode(\func_get_args());
if (bbn\Str::isUid($id) && ($text = $this->text($id))) {
$res = [
'id' => $id,
'text' => $text
];
if ($opts = $this->items($id)) {
$res['items'] = [];
foreach ($opts as $o){
if ($t = $this->tree($o)) {
$res['items'][] = $t;
}
}
}
return $res;
}
return null;
}
Returns a simple hierarchical structure with just text, id and items BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions