Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
4736675b
Unverified
Commit
4736675b
authored
4 years ago
by
Seamus Lee
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #18461 from demeritcowboy/entity-drupal-9
drupal#138
- Drupal 9 deprecations
parents
1ff24059
b5059226
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Utils/System/Drupal8.php
+6
-6
6 additions, 6 deletions
CRM/Utils/System/Drupal8.php
with
6 additions
and
6 deletions
CRM/Utils/System/Drupal8.php
+
6
−
6
View file @
4736675b
...
...
@@ -34,7 +34,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
}
/** @var \Drupal\user\Entity\User $account */
$account
=
entity_create
(
'user'
);
$account
=
\Drupal
::
entityTypeManager
()
->
getStorage
(
'user'
)
->
create
(
);
$account
->
setUsername
(
$params
[
'cms_name'
])
->
setEmail
(
$params
[
$mail
]);
// Allow user to set password only if they are an admin or if
...
...
@@ -109,7 +109,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
* @inheritDoc
*/
public
function
updateCMSName
(
$ufID
,
$email
)
{
$user
=
entity_load
(
'user'
,
$ufID
);
$user
=
\Drupal
::
entityTypeManager
()
->
getStorage
(
'user'
)
->
load
(
$ufID
);
if
(
$user
&&
$user
->
getEmail
()
!=
$email
)
{
$user
->
setEmail
(
$email
);
...
...
@@ -134,7 +134,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
if
(
!
empty
(
$params
[
'name'
]))
{
$name
=
$params
[
'name'
];
$user
=
entity_create
(
'user'
);
$user
=
\Drupal
::
entityTypeManager
()
->
getStorage
(
'user'
)
->
create
(
);
$user
->
setUsername
(
$name
);
// This checks for both username uniqueness and validity.
...
...
@@ -152,7 +152,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
if
(
!
empty
(
$params
[
'mail'
]))
{
$mail
=
$params
[
'mail'
];
$user
=
entity_create
(
'user'
);
$user
=
\Drupal
::
entityTypeManager
()
->
getStorage
(
'user'
)
->
create
(
);
$user
->
setEmail
(
$mail
);
// This checks for both email uniqueness.
...
...
@@ -172,7 +172,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
*/
public
function
getLoginURL
(
$destination
=
''
)
{
$query
=
$destination
?
[
'destination'
=>
$destination
]
:
[];
return
\Drupal
::
url
(
'user.login'
,
[],
[
'query'
=>
$query
]);
return
\Drupal
\Core\Url
::
fromRoute
(
'user.login'
,
[],
[
'query'
=>
$query
])
->
toString
()
;
}
/**
...
...
@@ -430,7 +430,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
CRM_Utils_Hook
::
config
(
$config
);
if
(
$loadUser
)
{
if
(
!
empty
(
$params
[
'uid'
])
&&
$username
=
\Drupal\user\Entity\User
::
load
(
$params
[
'uid'
])
->
get
Usern
ame
())
{
if
(
!
empty
(
$params
[
'uid'
])
&&
$username
=
\Drupal\user\Entity\User
::
load
(
$params
[
'uid'
])
->
get
AccountN
ame
())
{
$this
->
loadUser
(
$username
);
}
elseif
(
!
empty
(
$params
[
'name'
])
&&
!
empty
(
$params
[
'pass'
])
&&
\Drupal
::
service
(
'user.auth'
)
->
authenticate
(
$params
[
'name'
],
$params
[
'pass'
]))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment