You are here

public function SiteConfigureForm::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php \Drupal\Core\Installer\Form\SiteConfigureForm::__construct()
  2. 10 core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php \Drupal\Core\Installer\Form\SiteConfigureForm::__construct()

Constructs a new SiteConfigureForm.

Note, for BC reasons, we cannot typehint the last 2 parameters since this function used to take 6 arguments, including the 'state' service as the fourth parameter.

@todo Clean this up in drupal:10.0.0.

Parameters

string $root: The app root.

string $site_path: The site path.

\Drupal\user\UserStorageInterface $user_storage: The user storage.

\Drupal\Core\Extension\ModuleInstallerInterface $module_installer: The module installer.

\Drupal\Core\Locale\CountryManagerInterface $country_manager: The country manager.

Throws

\InvalidArgumentException Thrown when either the $module_installer or $country_manager parameters are not of the correct type.

Overrides ConfigFormBase::__construct

See also

https://www.drupal.org/node/3159456

File

core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php, line 89

Class

SiteConfigureForm
Provides the site configuration form.

Namespace

Drupal\Core\Installer\Form

Code

public function __construct($root, $site_path, UserStorageInterface $user_storage, $module_installer, $country_manager) {
  $this->root = $root;
  $this->sitePath = $site_path;
  $this->userStorage = $user_storage;
  if (!$module_installer instanceof ModuleInstallerInterface) {
    @trigger_error('Passing the state service to ' . __METHOD__ . '() is deprecated in drupal:9.1.0 and will be removed before drupal:10.0.0. Only pass five parameters instead. See https://www.drupal.org/node/3158440', E_USER_DEPRECATED);
    $module_installer = $country_manager;
    $country_manager = @func_get_arg(5);
  }
  if (!$module_installer instanceof ModuleInstallerInterface) {
    throw new \InvalidArgumentException('The fourth argument must implement \\Drupal\\Core\\Extension\\ModuleInstallerInterface.');
  }
  if (!$country_manager instanceof CountryManagerInterface) {
    throw new \InvalidArgumentException('The fifth argument must implement \\Drupal\\Core\\Locale\\CountryManager.');
  }
  $this->moduleInstaller = $module_installer;
  $this->countryManager = $country_manager;
}