mirror of
https://github.com/getgrav/grav.git
synced 2026-07-05 23:39:16 +02:00
Fix for Validation::typeX() missing causing validation errors - #626
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user