public function getMetaBoxConfig($config, $key = null)
    {
        // allow shorthand
        if (!array_key_exists('fields', $config)) {
            $fields = array();
            foreach ($config as $field) {
                // Arbitrary HTML is allowed
                if (preg_match('/^\</', $field) && preg_match('/\>$/', $field)) {
                    $fields[md5(mt_rand())] = array(
                        'type'=>'html',
                        'label'=>null,
                        'value'=>$field,
                    );
                    continue;
                }

                $fields[$field] = $this->getField($field);
            }
            $config = array('fields'=>$fields);
        }
        if (Arr::iterable($config['fields'])) {
            $fields = array();
            foreach ($config['fields'] as $k => $v) {
                if (is_array($v)) {
                    $fields[$k] = $v;
                } else {
                    $fields[$v] = $this->getField($v);
                }
            }
            $config['fields'] = $fields;
        }

        // defaults
        $config['title']    = (array_key_exists('title', $config)) ? $config['title'] : $this->getMetaBoxTitle($key);
        $config['context']  = (array_key_exists('context', $config)) ? $config['context'] : 'normal';
        $config['priority'] = (array_key_exists('priority', $config)) ? $config['priority'] : 'high';
        return $config;
    }
public function getMetaBoxConfig($config, $key = null)
    {
        // allow shorthand
        if (!array_key_exists('fields', $config)) {
            $fields = array();
            foreach ($config as $field) {
                // Arbitrary HTML is allowed
                if (preg_match('/^\</', $field) && preg_match('/\>$/', $field)) {
                    $fields[md5(mt_rand())] = array(
                        'type'=>'html',
                        'label'=>null,
                        'value'=>$field,
                    );
                    continue;
                }

                $fields[$field] = $this->getField($field);
            }
            $config = array('fields'=>$fields);
        }
        if (Arr::iterable($config['fields'])) {
            $fields = array();
            foreach ($config['fields'] as $k => $v) {
                if (is_array($v)) {
                    $fields[$k] = $v;
                } else {
                    $fields[$v] = $this->getField($v);
                }
            }
            $config['fields'] = $fields;
        }

        // defaults
        $config['title']    = (array_key_exists('title', $config)) ? $config['title'] : $this->getMetaBoxTitle($key);
        $config['context']  = (array_key_exists('context', $config)) ? $config['context'] : 'normal';
        $config['priority'] = (array_key_exists('priority', $config)) ? $config['priority'] : 'high';
        return $config;
    }
public function getMetaBoxConfig ( $ config , $ key = null ) { // allow shorthand if ( ! array_key_exists ( 'fields' , $ config ) ) { $ fields = array ( ) ; foreach ( $ config as $ field ) { // Arbitrary HTML is allowed if ( preg_match ( '/^\</' , $ field ) && preg_match ( '/\>$/' , $ field ) ) { $ fields [ md5 ( mt_rand ( ) ) ] = array ( 'type' => 'html' , 'label' => null , 'value' => $ field , ) ; continue ; } $ fields [ $ field ] = $ this -> getField ( $ field ) ; } $ config = array ( 'fields' => $ fields ) ; } if ( Arr :: iterable ( $ config [ 'fields' ] ) ) { $ fields = array ( ) ; foreach ( $ config [ 'fields' ] as $ k => $ v ) { if ( is_array ( $ v ) ) { $ fields [ $ k ] = $ v ; } else { $ fields [ $ v ] = $ this -> getField ( $ v ) ; } } $ config [ 'fields' ] = $ fields ; } // defaults $ config [ 'title' ] = ( array_key_exists ( 'title' , $ config ) ) ? $ config [ 'title' ] : $ this -> getMetaBoxTitle ( $ key ) ; $ config [ 'context' ] = ( array_key_exists ( 'context' , $ config ) ) ? $ config [ 'context' ] : 'normal' ; $ config [ 'priority' ] = ( array_key_exists ( 'priority' , $ config ) ) ? $ config [ 'priority' ] : 'high' ; return $ config ; }
Get a meta box config handling defaults
@param array $config
@param string $key
@return array
Get a meta box config handling defaults