diff --git a/src/Model/Table/SettingProviders/BaseSettingsProvider.php b/src/Model/Table/SettingProviders/BaseSettingsProvider.php index 7bb6442..df92747 100644 --- a/src/Model/Table/SettingProviders/BaseSettingsProvider.php +++ b/src/Model/Table/SettingProviders/BaseSettingsProvider.php @@ -163,18 +163,22 @@ class BaseSettingsProvider $setting['error'] = false; if (!$skipValidation) { $validationResult = true; - if (!isset($setting['value'])) { - $validationResult = $this->settingValidator->testEmptyBecomesDefault(null, $setting); - } else if (isset($setting['test'])) { - $setting['value'] = $setting['value'] ?? ''; - $validationResult = $this->evaluateFunctionForSetting($setting['test'], $setting); - } - if ($validationResult !== true) { - $setting['severity'] = $setting['severity'] ?? 'warning'; - if (!in_array($setting['severity'], $this->severities)) { - $setting['severity'] = 'warning'; + if (empty($setting['value']) && !empty($setting['empty'])) { + $validationResult = true; + } else { + if (!isset($setting['value'])) { + $validationResult = $this->settingValidator->testEmptyBecomesDefault(null, $setting); + } else if (isset($setting['test'])) { + $setting['value'] = $setting['value'] ?? ''; + $validationResult = $this->evaluateFunctionForSetting($setting['test'], $setting); + } + if ($validationResult !== true) { + $setting['severity'] = $setting['severity'] ?? 'warning'; + if (!in_array($setting['severity'], $this->severities)) { + $setting['severity'] = 'warning'; + } + $setting['errorMessage'] = $validationResult; } - $setting['errorMessage'] = $validationResult; } $setting['error'] = $validationResult !== true ? true : false; } diff --git a/src/Model/Table/SettingProviders/CerebrateSettingsProvider.php b/src/Model/Table/SettingProviders/CerebrateSettingsProvider.php index d073e92..61f6993 100644 --- a/src/Model/Table/SettingProviders/CerebrateSettingsProvider.php +++ b/src/Model/Table/SettingProviders/CerebrateSettingsProvider.php @@ -140,6 +140,7 @@ class CerebrateSettingsProvider extends BaseSettingsProvider 'type' => 'string', 'description' => __('The hostname of an HTTP proxy for outgoing sync requests. Leave empty to not use a proxy.'), 'test' => 'testHostname', + 'empty' => true ], 'Proxy.port' => [ 'name' => __('Port'), @@ -147,6 +148,7 @@ class CerebrateSettingsProvider extends BaseSettingsProvider 'type' => 'integer', 'description' => __('The TCP port for the HTTP proxy.'), 'test' => 'testForRangeXY', + 'empty' => true ], 'Proxy.user' => [ 'name' => __('User'), @@ -154,6 +156,7 @@ class CerebrateSettingsProvider extends BaseSettingsProvider 'description' => __('The authentication username for the HTTP proxy.'), 'default' => 'admin', 'dependsOn' => 'proxy.host', + 'empty' => true ], 'Proxy.password' => [ 'name' => __('Password'), @@ -161,6 +164,7 @@ class CerebrateSettingsProvider extends BaseSettingsProvider 'description' => __('The authentication password for the HTTP proxy.'), 'default' => '', 'dependsOn' => 'proxy.host', + 'empty' => true ], ], ],