Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Part of #1971384: [META] Convert page callbacks to controllers.
Convert form defined in user_form_test_current_password to a Controller.
Comment | File | Size | Author |
---|---|---|---|
#8 | password_controller-2035689-8.patch | 4.55 KB | plopesc |
#8 | interdiff.txt | 1.14 KB | plopesc |
#5 | password_controller-2035689-5.patch | 4.53 KB | plopesc |
#5 | interdiff.txt | 2.93 KB | plopesc |
#3 | password_controller-2035689-3.patch | 4.8 KB | plopesc |
Comments
Comment #1
plopescHello
Attaching first approach for this task.
This patch has problems using the paramconverters, given that 'user', instead of taking the uid from path, takes the current user uid.
How should work this converter?
Regards
Comment #3
plopescHello
I fixed my converter error. I found that buildForm method parameter must respect the same name as in routing to be loaded well. I expected the User value in $acconut parameter instead of $user as defined in route.
Then I found another problem. $user entity is loaded fine, but tests still not working given that PhpassHashedPassword class is not yet ready to work with EntityNG values and expect that $user->pass is a string instead of FieldItemInterface.
Now tests passes because user_load funtion returns an instance of UserBCDecorator.
Then I think we have two options:
Attaching patch that follows approach in bullet 1.
Regards
Comment #4
vijaycs85Looks good to me except few minor doc fixes (below).
Minor: doc needs update.
Minor: Can we use {@inheritdoc}
Comment #5
plopescHello
Re-rolled using FormBase and following advices in #4
Regards.
Comment #6
disasm CreditAttribution: disasm commentedReviewed this, patch applies, tests pass, conversion is straight forward, marking RTBC!
Comment #7
webchickIn general we typehint with interfaces rather than classes. I think this should be UserInterface.
Comment #8
plopescTypehinting fixed.
Regards.
Comment #9
xjmThanks for your work on this issue! Please see #1971384-43: [META] Convert page callbacks to controllers for an update on the routing system conversion process.
Comment #10
disasm CreditAttribution: disasm commentedClean and simple! RTBC!
Comment #11
webchickLooks great, thanks!
Committed and pushed to 8.x.