diff --git a/CHANGELOG.md b/CHANGELOG.md index b4ec4ea67..ac2d09e04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/system/src/Grav/Common/Data/Validation.php b/system/src/Grav/Common/Data/Validation.php index 4471e23ab..c2911f2b2 100644 --- a/system/src/Grav/Common/Data/Validation.php +++ b/system/src/Grav/Common/Data/Validation.php @@ -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)) {