src/PeskyCMF/Traits/DataValidationHelper.php
static public function fixValidationErrorsKeys(array $errors) {
        foreach ($errors as $key => $messages) {
            if (strpos($key, '.') !== false) {
                $newKey = preg_replace(
                    ['%^([^\]]+)\]%', '%\[\]\]%'],
                    ['$1', '][]'],
                    str_replace('.', '][', $key) . ']'
                );
                $errors[$newKey] = $messages;
                unset($errors[$key]);
            }
        }

        return $errors;
    }
static public function fixValidationErrorsKeys(array $errors) {
        foreach ($errors as $key => $messages) {
            if (strpos($key, '.') !== false) {
                $newKey = preg_replace(
                    ['%^([^\]]+)\]%', '%\[\]\]%'],
                    ['$1', '][]'],
                    str_replace('.', '][', $key) . ']'
                );
                $errors[$newKey] = $messages;
                unset($errors[$key]);
            }
        }

        return $errors;
    }
static public function fixValidationErrorsKeys ( array $ errors ) { foreach ( $ errors as $ key => $ messages ) { if ( strpos ( $ key , '.' ) !== false ) { $ newKey = preg_replace ( [ '%^([^\]]+)\]%' , '%\[\]\]%' ] , [ '$1' , '][]' ] , str_replace ( '.' , '][' , $ key ) . ']' ) ; $ errors [ $ newKey ] = $ messages ; unset ( $ errors [ $ key ] ) ; } } return $ errors ; }
Replace keys like 'some.column' by 'some[column]' to fit <input> names
@param array $errors
@return array
Replace keys like some . column by some [ column ] to fit <input > names