method items documentation in bbn\User\Preferences
Return all the IDs of the children of the given option where the user has a preference in the user's order.
Example
$pref->items('finder', 'appui');
// (array) = [
// "943d955824ef11eca47652540000cfbe",
// "9c57439824ef11eca47652540000cfbe",
// "9ee7450224ef11eca47652540000cfbe",
// "944190af24ef11eca47652540000cfbe",
// ]
function($code)
{
// Gets the Ids of the corresponding options in their natural order (num or text)
if ($items = $this->opt->items(\func_get_args())) {
// Creating an array based on the user's order
$res = [];
// Replacing regular num values by user's values if any
foreach ($items as $i => $it) {
$res[] = ['id' => $it, 'num' => $i + 1];
if ($tmp = $this->get($it)) {
if (isset($tmp['num'])) {
$res[$i]['num'] = $tmp['num'];
}
}
}
// Reordering the array based on num
X::sortBy($res, 'num');
// Returns a simple array with only the IDs
return array_map(
function ($a) {
return $a['id'];
},
$res
);
}
return $items;
}
Return all the IDs of the children of the given option where the user has a preference in the user's order. 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-2025
BBN Solutions