method export documentation in bbn\Appui\Option

function(string $id, string $mode = 'single') { $modes = ['children', 'full', 'sfull', 'schildren', 'simple', 'single']; if (!in_array($mode, $modes)) { throw new \Exception(X::_("The given mode is forbidden")); } $simple = false; switch ($mode) { case 'single': $o = $this->rawOption($id); break; case 'simple': $o = $this->option($id); $simple = true; break; case 'schildren': $o = $this->fullOptions($id); $simple = true; break; case 'children': $o = $this->exportDb($id, false, true); break; case 'full': $o = $this->exportDb($id, true, true); break; case 'sfull': $o = $this->fullTree($id); $simple = true; break; } if ($o) { if ($simple) { $opt =& $this; $fn = function ($o) use (&$opt) { $cfg = $opt->getCfg($o[$this->fields['id']]); if (!is_array($cfg) || !empty($cfg['inherit_from'])) { $cfg = []; } elseif (!empty($cfg['schema']) && is_string($cfg['schema'])) { $cfg['schema'] = json_decode($cfg['schema'], true); } if (isset($cfg['id'])) { //unset($cfg['id']); } if (isset($cfg['scfg']) && !empty($cfg['scfg']['schema']) && is_string($cfg['scfg']['schema']) ) { $cfg['scfg']['schema'] = json_decode($cfg['scfg']['schema'], true); } if (!empty($cfg['id_root_alias'])) { if ($codes = $opt->getCodePath($cfg['id_root_alias'])) { $cfg['id_root_alias'] = $codes; } else { unset($cfg['id_root_alias']); } } foreach ($cfg as $n => $v) { if (!$v) { unset($cfg[$n]); } } if (!empty($cfg)) { $o[$this->fields['cfg']] = $cfg; } unset($o[$this->fields['id_parent']]); if (isset($o['num_children'])) { unset($o['num_children']); } if (isset($o['alias'])) { unset($o['alias']); } foreach ($o as $n => $v) { if (!$v) { unset($o[$n]); } } if (!empty($o[$this->fields['id_alias']]) && ($codes = $opt->getCodePath($o[$this->fields['id_alias']])) ) { $o[$this->fields['id_alias']] = $codes; } else { unset($o[$this->fields['id_alias']]); } return $o; }; switch ($mode) { case 'simple': $o = $fn($o); break; case 'schildren': $o = X::map($fn, $o, 'items'); break; case 'sfull': $o = $fn($o); $o['items'] = empty($o['items']) ? [] : X::map($fn, $o['items'], 'items'); break; } } return $o; } return null; }

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.