function UpdateSettingsForm::buildForm
Same name in other branches
- 9 core/modules/update/src/UpdateSettingsForm.php \Drupal\update\UpdateSettingsForm::buildForm()
- 8.9.x core/modules/update/src/UpdateSettingsForm.php \Drupal\update\UpdateSettingsForm::buildForm()
- 11.x core/modules/update/src/UpdateSettingsForm.php \Drupal\update\UpdateSettingsForm::buildForm()
Overrides ConfigFormBase::buildForm
File
-
core/
modules/ update/ src/ UpdateSettingsForm.php, line 35
Class
- UpdateSettingsForm
- Configure update settings for this site.
Namespace
Drupal\updateCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['update_check_frequency'] = [
'#type' => 'radios',
'#title' => $this->t('Check for updates'),
'#config_target' => new ConfigTarget('update.settings', 'check.interval_days', toConfig: fn($value) => intval($value)),
'#options' => [
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.'),
];
$form['update_check_disabled'] = [
'#type' => 'checkbox',
'#title' => $this->t('Check for updates of uninstalled modules and themes'),
'#config_target' => 'update.settings:check.disabled_extensions',
];
$form['update_notify_emails'] = [
'#type' => 'textarea',
'#title' => $this->t('Email addresses to notify when updates are available'),
'#rows' => 4,
'#config_target' => new ConfigTarget('update.settings', 'notification.emails', static::class . '::arrayToMultiLineString', static::class . '::multiLineStringToArray'),
'#description' => $this->t('Whenever your site checks for available updates and finds new releases, it can notify a list of users via email. Put each address on a separate line. If blank, no emails will be sent.'),
];
$form['update_notification_threshold'] = [
'#type' => 'radios',
'#title' => $this->t('Email notification threshold'),
'#config_target' => 'update.settings:notification.threshold',
'#options' => [
'all' => $this->t('All newer versions'),
'security' => $this->t('Only security updates'),
],
'#description' => $this->t('You can choose to send email only if a security update is available, or to be notified about all newer versions. If there are updates available of Drupal core or any of your installed modules and themes, your site will always print a message on the <a href=":status_report">status report</a> page. If there is a security update, an error message will be printed on administration pages for users with <a href=":update_permissions">permission to view update notifications</a>.', [
':status_report' => Url::fromRoute('system.status')->toString(),
':update_permissions' => Url::fromRoute('user.admin_permissions', [], [
'fragment' => 'module-update',
])->toString(),
]),
];
return parent::buildForm($form, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.