method mapCfg documentation in bbn\Appui\Option

Applies a function to children of an option, with the cfg array included

Example

function(callable $f, $id, $deep = false) { $opts = \is_array($id) ? $id : ( $deep ? $this->fullTree($id) : $this->fullOptions($id) ); if (isset($opts['items'])) { $opts = $opts['items']; } $res = []; if (\is_array($opts)) { foreach ($opts as $i => $o){ $o[$this->fields['cfg']] = $this->getCfg($o[$this->fields['id']]); $opts[$i] = $f($o); if ($deep && $opts[$i] && !empty($opts[$i]['items'])) { $opts[$i]['items'] = $this->mapCfg($f, $opts[$i]['items'], 1); } if (\is_array($opts[$i])) { $res[] = $opts[$i]; } } } return $res; }

Applies a function to children of an option, with the cfg array included 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.