method setCfg documentation in bbn\Appui\Option

Sets the cfg column of a given option in the table through an array

Example

X::dump($opt->getCfg('bbn_ide')); // array ['sortable' => true] X::dump($opt->setCfg(12, [ 'desc' => "I am a cool option", 'sortable' => true ])); // (int) 1 X::dump($opt->getCfg('bbn_ide')); // array ['desc' => "I am a cool option", 'sortable' => true]; function($id, array $cfg, bool $merge = false) { if ($this->check() && $this->exists($id)) { if (isset($cfg['inherited_from'])) { unset($cfg['inherited_from']); } if (isset($cfg[$this->fields['id']])) { unset($cfg[$this->fields['id']]); } if (isset($cfg['permissions']) && !in_array($cfg['permissions'], ['single', 'cascade', 'all', 'children'])) { unset($cfg['permissions']); } if ($merge && ($old_cfg = $this->getCfg($id))) { $cfg = array_merge($old_cfg, $cfg); } $c =& $this->class_cfg; if ($res = $this->db->update( $c['table'], [ $this->fields['cfg'] => $cfg ? json_encode($cfg) : null ], [ $this->fields['id'] => $id ] ) ) { if (isset($old_cfg['inheritance'], $cfg['inheritance']) && $old_cfg['inheritance'] !== $cfg['inheritance']) { $this->deleteCache($id, true); } else{ $this->deleteCache($id); } return $res; } return 0; } return null; }

Sets the cfg column of a given option in the table through an array 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.