function add_field($name, $title=null, \Closure $display_callback=null, Setting\Section $section=null, $default=null)
    {
        if(is_array($name)){

            $field = $name + [
                $display_callback=null,
                $section = null,
                $default = null,
                $type = 'text'
            ];

        } else {
            //legacy full param format
            $field = compact('name','title','display_callback','section');
        }

        if(empty($field['section'])){
            $field['section'] = $this->get_default_section();
        }

        $this->fields[$field['name']] = $field;
    }
function add_field($name, $title=null, \Closure $display_callback=null, Setting\Section $section=null, $default=null)
    {
        if(is_array($name)){

            $field = $name + [
                $display_callback=null,
                $section = null,
                $default = null,
                $type = 'text'
            ];

        } else {
            //legacy full param format
            $field = compact('name','title','display_callback','section');
        }

        if(empty($field['section'])){
            $field['section'] = $this->get_default_section();
        }

        $this->fields[$field['name']] = $field;
    }
function add_field ( $ name , $ title = null , \ Closure $ display_callback = null , Setting \ Section $ section = null , $ default = null ) { if ( is_array ( $ name ) ) { $ field = $ name + [ $ display_callback = null , $ section = null , $ default = null , $ type = 'text' ] ; } else { //legacy full param format $ field = compact ( 'name' , 'title' , 'display_callback' , 'section' ) ; } if ( empty ( $ field [ 'section' ] ) ) { $ field [ 'section' ] = $ this -> get_default_section ( ) ; } $ this -> fields [ $ field [ 'name' ] ] = $ field ; }
Just pass name which is an assoc array -
what you see here are legacy params
Just pass name which is an assoc array - what you see here are legacy params