protected function UserManager::getUserFields in Social Auth 8.2
Same name and namespace in other branches
- 3.x src/User/UserManager.php \Drupal\social_auth\User\UserManager::getUserFields()
Returns an array of fields to initialize the creation of the user.
Parameters
\Drupal\social_auth\User\SocialAuthUserInterface $user: The data of the user to be created.
string $langcode: The current UI language.
Return value
array Fields to initialize for the user creation.
1 call to UserManager::getUserFields()
- UserManager::createUser in src/
User/ UserManager.php - Create a new user account.
File
- src/
User/ UserManager.php, line 493
Class
- UserManager
- Manages database related tasks.
Namespace
Drupal\social_auth\UserCode
protected function getUserFields(SocialAuthUserInterface $user, $langcode) {
$fields = [
'name' => $this
->generateUniqueUsername($user
->getName()),
'mail' => $user
->getEmail(),
'init' => $user
->getEmail(),
'pass' => $this
->userPassword(32),
'status' => $this
->getNewUserStatus(),
'langcode' => $langcode,
'preferred_langcode' => $langcode,
'preferred_admin_langcode' => $langcode,
'user_picture' => $user
->getPicture(),
];
// Dispatches SocialAuthEvents::USER_FIELDS, so that other modules can
// update this array before an user is saved.
$event = new UserFieldsEvent($fields, $this
->getPluginId(), $user);
$this->eventDispatcher
->dispatch(SocialAuthEvents::USER_FIELDS, $event);
$fields = $event
->getUserFields();
return $fields;
}