Issue #3437319 by srishtiiee, narendraR, pradhumanjain2311, phenaproxima, Wim Leers: Add validation constraints to update.settings
(cherry picked from commit d7bcfdf6d7
)
merge-requests/7853/head
parent
af5acaaccb
commit
3ade5afd02
|
@ -3,6 +3,8 @@
|
|||
update.settings:
|
||||
type: config_object
|
||||
label: 'Update settings'
|
||||
constraints:
|
||||
FullyValidatable: ~
|
||||
mapping:
|
||||
check:
|
||||
type: mapping
|
||||
|
@ -14,6 +16,10 @@ update.settings:
|
|||
interval_days:
|
||||
type: integer
|
||||
label: 'Days since last check'
|
||||
constraints:
|
||||
# @see \Drupal\update\UpdateSettingsForm::buildForm()
|
||||
# The options are daily and weekly.
|
||||
Choice: [1, 7]
|
||||
fetch:
|
||||
type: mapping
|
||||
label: 'Fetch settings'
|
||||
|
@ -25,9 +31,15 @@ update.settings:
|
|||
max_attempts:
|
||||
type: integer
|
||||
label: 'Maximum attempts'
|
||||
constraints:
|
||||
Range:
|
||||
min: 1
|
||||
timeout:
|
||||
type: integer
|
||||
label: 'Timeout in seconds'
|
||||
constraints:
|
||||
Range:
|
||||
min: 1
|
||||
notification:
|
||||
type: mapping
|
||||
label: 'Notification settings'
|
||||
|
@ -41,3 +53,6 @@ update.settings:
|
|||
threshold:
|
||||
type: string
|
||||
label: 'Email notification threshold'
|
||||
constraints:
|
||||
# @see \Drupal\update\UpdateSettingsForm::buildForm()
|
||||
Choice: [all, security]
|
||||
|
|
|
@ -19,6 +19,12 @@ process:
|
|||
'notification/threshold': update_notification_threshold
|
||||
'notification/emails': update_notify_emails
|
||||
'check/interval_days': update_check_frequency
|
||||
'check/disabled_extensions':
|
||||
plugin: default_value
|
||||
default_value: false
|
||||
'fetch/timeout':
|
||||
plugin: default_value
|
||||
default_value: 30
|
||||
destination:
|
||||
plugin: config
|
||||
config_name: update.settings
|
||||
|
|
|
@ -36,10 +36,13 @@ class UpdateSettingsForm extends ConfigFormBase {
|
|||
$form['update_check_frequency'] = [
|
||||
'#type' => 'radios',
|
||||
'#title' => $this->t('Check for updates'),
|
||||
'#config_target' => 'update.settings:check.interval_days',
|
||||
'#config_target' => new ConfigTarget(
|
||||
'update.settings',
|
||||
'check.interval_days',
|
||||
toConfig: fn($value) => intval($value)),
|
||||
'#options' => [
|
||||
'1' => $this->t('Daily'),
|
||||
'7' => $this->t('Weekly'),
|
||||
1 => $this->t('Daily'),
|
||||
7 => $this->t('Weekly'),
|
||||
],
|
||||
'#description' => $this->t('Select how frequently you want to automatically check for new releases of your currently installed modules and themes.'),
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue