function UserRegistrationResource::__construct

Same name and namespace in other branches
  1. 11.x core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php \Drupal\user\Plugin\rest\resource\UserRegistrationResource::__construct()
  2. 10 core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php \Drupal\user\Plugin\rest\resource\UserRegistrationResource::__construct()
  3. 9 core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php \Drupal\user\Plugin\rest\resource\UserRegistrationResource::__construct()
  4. 8.9.x core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php \Drupal\user\Plugin\rest\resource\UserRegistrationResource::__construct()

Constructs a Drupal\rest\Plugin\ResourceBase object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin ID for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

array $serializer_formats: The available serialization formats.

\Psr\Log\LoggerInterface $logger: A logger instance.

Overrides ResourceBase::__construct

File

core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php, line 44

Class

UserRegistrationResource
Represents user registration as a resource.

Namespace

Drupal\user\Plugin\rest\resource

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, array $serializer_formats, LoggerInterface $logger, protected ImmutableConfig $userSettings, protected AccountInterface $currentUser, protected PasswordGeneratorInterface $passwordGenerator, ?NotificationHandler $notification_handler = NULL) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $serializer_formats, $logger);
  if ($notification_handler === NULL) {
    @trigger_error('Calling ' . __CLASS__ . ' constructor without the $notificationHandler argument is deprecated in drupal:11.5.0 and it will be required in drupal:12.0.0. See https://www.drupal.org/node/3539363', E_USER_DEPRECATED);
  }
  $this->notificationHandler = $notification_handler ?? \Drupal::service(NotificationHandler::class);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.