method exportDb documentation in bbn\Appui\Option

Converts an option or a hierarchy to a multi-level array with JSON values

If $return is false the resulting array will be printed

Example

function($id, bool $deep = false, bool $return = false, bool $aliases = false) { if (($ret = $deep ? $this->rawTree($id) : $this->rawOptions($id))) { $ret = $this->analyzeOut($ret); $res = []; $done = []; $max = 3; foreach ($ret['options'] as $i => $o) { if (!$i || in_array($o[$this->fields['id_parent']], $done, true)) { if (empty($o[$this->fields['id_alias']])) { $res[] = $o; $done[] = $o[$this->fields['id']]; } } } while ($max && (count($res) < count($ret['options']))) { foreach ($ret['options'] as $i => $o) { if (!empty($o[$this->fields['id_alias']]) && !in_array($o[$this->fields['id']], $done, true) && in_array($o[$this->fields['id_parent']], $done, true) && in_array($o[$this->fields['id_alias']], $done, true) ) { $res[] = $o; $done[] = $o[$this->fields['id']]; } } $max--; } if (count($res) < count($ret['options'])) { foreach ($ret['options'] as $i => $o) { if (!in_array($o[$this->fields['id_parent']], $done, true)) { $o[$this->fields['id_parent']] = $this->getCodePath($o[$this->fields['id_parent']]); } if (!empty($o[$this->fields['id_alias']]) && !in_array($o[$this->fields['id']], $done, true) ) { if (!in_array($o[$this->fields['id_alias']], $done, true)) { $code_path = $this->getCodePath($o[$this->fields['id_alias']]); $o[$this->fields['id_alias']] = $code_path ?: $o[$this->fields['id_alias']]; } $res[] = $o; $done[] = $o[$this->fields['id']]; } } } return $return ? $res : var_export($res, 1); } return null; }

Converts an option or a hierarchy to a multi-level array with JSON values 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.