method items documentation in bbn\Appui\Option
Returns an array of the children's IDs of the given option sorted by order or text
Example
X::dump($opt->items(12));
// array [40, 41, 42, 44, 45, 43, 46, 47]
function($code = NULL)
{
if (bbn\Str::isUid($id = $this->fromCode(\func_get_args()))) {
if (($res = $this->cacheGet($id, __FUNCTION__)) !== false) {
return $res;
}
$cfg = $this->getCfg($id) ?: [];
if ($cfg || $this->exists($id)) {
// If not sortable returning an array ordered by text
$order = empty($cfg['sortable']) ? [
$this->fields['text'] => 'ASC',
$this->fields['code'] => 'ASC',
$this->fields['id'] => 'ASC',
] : [
$this->fields['num'] => 'ASC',
$this->fields['text'] => 'ASC',
$this->fields['code'] => 'ASC',
$this->fields['id'] => 'ASC',
];
$res = $this->db->getColumnValues(
$this->class_cfg['table'],
$this->fields['id'], [
$this->fields['id_parent'] => $id,
], $order
);
$this->cacheSet($id, __FUNCTION__, $res);
return $res;
}
}
return null;
}
Returns an array of the children's IDs of the given option sorted by order or text 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