public static function formatValidationErrors($errors)
    {
        $msg = array();
        foreach ($errors as $i) {
            if (!is_array($i)) {
                throw new Kwf_Exception('Form errors must be of type array');
            }
            $name = '';
            if (isset($i['field'])) {
                $name = $i['field']->getFieldLabel();
                if (!$name) $name = $i['field']->getName();
            }
            if (isset($i['message'])) {
                $i['messages'] = array($i['message']);
            }
            foreach ($i['messages'] as $m) {
                $msg[] = ($name ? ($name.': ') : '').Kwf_Util_HtmlSpecialChars::filter($m);
            }
        }
        return $msg;
    }