From e07302510f27821e03af9567de503464fec2ed0c Mon Sep 17 00:00:00 2001 From: catch Date: Fri, 22 Apr 2022 10:06:30 +0100 Subject: [PATCH] Issue #3275216 by akoepke, larowlan: Fix UpdateSettingsForm dependency injection --- .../modules/update/src/UpdateSettingsForm.php | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/core/modules/update/src/UpdateSettingsForm.php b/core/modules/update/src/UpdateSettingsForm.php index 45455a3cf720..c1e5003f391c 100644 --- a/core/modules/update/src/UpdateSettingsForm.php +++ b/core/modules/update/src/UpdateSettingsForm.php @@ -2,11 +2,13 @@ namespace Drupal\update; +use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\Component\Utility\EmailValidatorInterface; /** * Configure update settings for this site. @@ -22,13 +24,27 @@ class UpdateSettingsForm extends ConfigFormBase implements ContainerInjectionInt */ protected $emailValidator; + /** + * Constructs an UpdateSettingsForm object. + * + * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory + * The factory for configuration objects. + * @param \Drupal\Component\Utility\EmailValidatorInterface $email_validator + * The email validator. + */ + public function __construct(ConfigFactoryInterface $config_factory, EmailValidatorInterface $email_validator) { + parent::__construct($config_factory); + $this->emailValidator = $email_validator; + } + /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { - $instance = parent::create($container); - $instance->emailValidator = $container->get('email.validator'); - return $instance; + return new static( + $container->get('config.factory'), + $container->get('email.validator') + ); } /**