Fix for Validation::typeX() missing causing validation errors - #626

This commit is contained in:
Andy Miller
2016-05-30 12:17:13 -06:00
parent 43c0ac275f
commit 4fbf4329fd
2 changed files with 6 additions and 6 deletions

View File

@@ -6,6 +6,7 @@
* Added support for `xx-XX` locale language lookups in `LanguageCodes` class [#854](https://github.com/getgrav/grav/issues/854)
1. [](#bugfix)
* Fix for corner-case redirect logic causing infinite loops and out-of-memory errors
* Fix for saving fields in expert mode that have no `Validation::typeX()` methods [#626](https://github.com/getgrav/grav-plugin-admin/issues/626)
* Detect if user really meant to extend parent blueprint, not another one (fixes old page type blueprints)
* Fixed a bug in `Page::relativePagePath()` when `Page::$name` is not defined

View File

@@ -49,16 +49,16 @@ class Validation
$type = (string) isset($field['validate']['type']) ? $field['validate']['type'] : $field['type'];
$method = 'type'.strtr($type, '-', '_');
if (!method_exists(__CLASS__, $method)) {
$method = 'typeText';
}
$name = ucfirst(isset($field['label']) ? $field['label'] : $field['name']);
$message = (string) isset($field['validate']['message'])
? $language->translate($field['validate']['message'])
: $language->translate('FORM.INVALID_INPUT', null, true) . ' "' . $language->translate($name) . '"';
$success = self::$method($value, $validate, $field);
if (method_exists(__CLASS__, $method)) {
$success = self::$method($value, $validate, $field);
} else {
$success = true;
}
if (!$success) {
$messages[$field['name']][] = $message;
@@ -325,7 +325,6 @@ class Validation
* @param array $field Blueprint for the field.
* @return bool True if validation succeeded.
*/
public static function typeNumber($value, array $params, array $field)
{
if (!is_numeric($value)) {