static public function formatSettings($settings=null)
    {
        if (isset($settings['data_source'])) {
            if (is_string($settings['data_source'])) {
                $data = explode(',', $settings['data_source']);
                $tdata = [];
                foreach ($data as $k => $v) {
                    if (strpos($v, '|')) {
                        $tmp = explode('|', $v);
                        $tdata[trim($tmp[0])] = trim($tmp[1]);
                    } else {
                        $tdata[trim($v)] = trim($v);
                    }
                }
                $settings['data_source'] = $tdata;
            }
            
            if (!isset($settings['fields'])) {
                $settings['fields'] = ['id', 'title', 'depth'];
            } else {
                $settings['fields'] = DataHelper::explode('\,\|', $settings['fields']);
            }
        }
        
        if (isset($settings['id'])) {
            $settings['id'] = static::formatId($settings['id']);
        }
        
        // settings readonly
        if (isset($settings['readonly']) && $settings['readonly']) {
            $settings['readonly'] = "readonly";
        }
        
        return $settings;
    }
static public function formatSettings($settings=null)
    {
        if (isset($settings['data_source'])) {
            if (is_string($settings['data_source'])) {
                $data = explode(',', $settings['data_source']);
                $tdata = [];
                foreach ($data as $k => $v) {
                    if (strpos($v, '|')) {
                        $tmp = explode('|', $v);
                        $tdata[trim($tmp[0])] = trim($tmp[1]);
                    } else {
                        $tdata[trim($v)] = trim($v);
                    }
                }
                $settings['data_source'] = $tdata;
            }
            
            if (!isset($settings['fields'])) {
                $settings['fields'] = ['id', 'title', 'depth'];
            } else {
                $settings['fields'] = DataHelper::explode('\,\|', $settings['fields']);
            }
        }
        
        if (isset($settings['id'])) {
            $settings['id'] = static::formatId($settings['id']);
        }
        
        // settings readonly
        if (isset($settings['readonly']) && $settings['readonly']) {
            $settings['readonly'] = "readonly";
        }
        
        return $settings;
    }
static public function formatSettings ( $ settings = null ) { if ( isset ( $ settings [ 'data_source' ] ) ) { if ( is_string ( $ settings [ 'data_source' ] ) ) { $ data = explode ( ',' , $ settings [ 'data_source' ] ) ; $ tdata = [ ] ; foreach ( $ data as $ k => $ v ) { if ( strpos ( $ v , '|' ) ) { $ tmp = explode ( '|' , $ v ) ; $ tdata [ trim ( $ tmp [ 0 ] ) ] = trim ( $ tmp [ 1 ] ) ; } else { $ tdata [ trim ( $ v ) ] = trim ( $ v ) ; } } $ settings [ 'data_source' ] = $ tdata ; } if ( ! isset ( $ settings [ 'fields' ] ) ) { $ settings [ 'fields' ] = [ 'id' , 'title' , 'depth' ] ; } else { $ settings [ 'fields' ] = DataHelper :: explode ( '\,\|' , $ settings [ 'fields' ] ) ; } } if ( isset ( $ settings [ 'id' ] ) ) { $ settings [ 'id' ] = static :: formatId ( $ settings [ 'id' ] ) ; } // settings readonly if ( isset ( $ settings [ 'readonly' ] ) && $ settings [ 'readonly' ] ) { $ settings [ 'readonly' ] = "readonly" ; } return $ settings ; }
format settings, can parse data source
@param  array $settings
@return array
format settings can parse data source