/** * Normalize parameters for field * * @param array $field * @return array */ public static function normalize($field) { $field = parent::normalize($field); $field = $field['multiple'] ? RWMB_Multiple_Values_Field::normalize($field) : $field; $field = wp_parse_args($field, array('size' => $field['multiple'] ? 5 : 0, 'select_all_none' => false)); return $field; }
/** * Normalize parameters for field * * @param array $field * * @return array */ public static function normalize($field) { $field = parent::normalize($field); $field = wp_parse_args($field, array('flatten' => true, 'query_args' => array(), 'field_type' => 'select_advanced')); if ('checkbox_tree' === $field['field_type']) { $field['field_type'] = 'checkbox_list'; $field['flatten'] = false; } switch ($field['field_type']) { case 'checkbox_list': case 'radio_list': $field['multiple'] = 'radio_list' === $field['field_type'] ? false : true; return RWMB_Input_List_Field::normalize($field); break; case 'select_advanced': return RWMB_Select_Advanced_Field::normalize($field); break; case 'select_tree': return RWMB_Select_Tree_Field::normalize($field); break; case 'select': default: return RWMB_Select_Field::normalize($field); break; } }
/** * Normalize parameters for field * * @param array $field * @return array */ public static function normalize($field) { $field = $field['multiple'] ? RWMB_Multiple_Values_Field::normalize($field) : $field; $field = RWMB_Input_Field::normalize($field); $field = parent::normalize($field); $field = wp_parse_args($field, array('collapse' => true, 'inline' => null)); $field['flatten'] = $field['multiple'] ? $field['flatten'] : true; $field['inline'] = !$field['multiple'] && !isset($field['inline']) ? true : $field['inline']; return $field; }
/** * Normalize parameters for field * * @param array $field * * @return array */ public static function normalize($field) { $field = parent::normalize($field); $field = wp_parse_args($field, array('flatten' => true, 'query_args' => array(), 'field_type' => 'select_advanced')); if ('checkbox_tree' === $field['field_type']) { $field['field_type'] = 'checkbox_list'; $field['flatten'] = false; } if ('radio_list' == $field['field_type']) { $field['multiple'] = false; } if ('checkbox_list' == $field['field_type']) { $field['multiple'] = true; } return call_user_func(array(self::get_type_class($field), 'normalize'), $field); }