mirror of
https://github.com/getgrav/grav.git
synced 2026-05-06 18:26:06 +02:00
Fix backend validation for file fields marked as required
Fixes https://github.com/getgrav/grav-plugin-form/issues/78
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
# v1.1.0-rc.4
|
||||
## 06/xx/2016
|
||||
|
||||
1. [](#bugfix)
|
||||
* Fix backend validation for file fields marked as required [grav-plugin-form#78](Fixes https://github.com/getgrav/grav-plugin-form/issues/78)
|
||||
|
||||
# v1.1.0-rc.3
|
||||
## 06/21/2016
|
||||
|
||||
|
||||
@@ -132,8 +132,15 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
|
||||
}
|
||||
$field = $this->items[$field];
|
||||
if (isset($field['validate']['required'])
|
||||
&& $field['validate']['required'] === true
|
||||
&& !isset($data[$name])) {
|
||||
&& $field['validate']['required'] === true) {
|
||||
|
||||
if (isset($data[$name])) {
|
||||
continue;
|
||||
}
|
||||
if ($field['type'] == 'file' && isset($data['data']['name'][$name])) { //handle case of file input fields required
|
||||
continue;
|
||||
}
|
||||
|
||||
$value = isset($field['label']) ? $field['label'] : $field['name'];
|
||||
$language = Grav::instance()['language'];
|
||||
$message = sprintf($language->translate('FORM.MISSING_REQUIRED_FIELD', null, true) . ' %s', $language->translate($value));
|
||||
|
||||
Reference in New Issue
Block a user