Commit e0730251 authored by catch's avatar catch
Browse files

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

parent 30e4e1cb
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -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')
    );
  }

  /**