Issue #3275216 by akoepke, larowlan: Fix UpdateSettingsForm dependency injection

merge-requests/2161/head
catch 2022-04-22 10:06:30 +01:00
parent 30e4e1cb0e
commit e07302510f
1 changed files with 19 additions and 3 deletions

View File

@ -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')
);
}
/**