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.
Replace deprecated usage of Drupal::url with Url::fromRoute.
https://api.drupal.org/api/drupal/core!lib!Drupal.php/function/Drupal::u...
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Url.php/function/...
Comment | File | Size | Author |
---|---|---|---|
#6 | 2781433-6.replace-deprecated-usage-of-drupal-url.patch | 989 bytes | jonathan1055 |
|
Comments
Comment #2
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedHi Vinayak Kothule,
Thanks for noticing this. I have added links to the old and new functions in the issue simmary.
Your patch needs a bit of work, though:
Fatal error: Class 'Url' not found
because you forgot to adduse \Drupal\Core\Url;
at the top.Url::fromRoute('entity.user.edit_form', ['user' => $user->id()])
returns an object, when previously\Drupal::url
was returning the actual string.Your patch passed because we do not actually have test coverage for the status report page yet. That is something that I might look to add in future. However, if you visit /admin/reports/status you can see the output manually.
Jonathan
Comment #3
Vinayak Kothule CreditAttribution: Vinayak Kothule as a volunteer and at Cybage Software Pvt Ltd. commentedComment #4
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedI have added tests to cover the status report page, on #2712465-2: 8.x test coverage. Now re-queueing the patch above, which should show the failures.
Comment #6
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedNo response from Vinayak, so here is a new patch. I added the necessary
use \Drupal\Core\Url;
and both of the calls to Url::fromRoute needed->toString()
Comment #8
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedCommitted. Thanks Vinayak for starting this issue.