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.
the getUrlFromPath method in TwigExtension is deprecated. So let's remove it here.
Beta phase evaluation
Issue category | Task. Work must be done to remove the deprecated getUrlFromPath method before 8.0.0 release. |
---|---|
Issue priority | Normal. Drupal 8 still works with this deprecated function still in place. |
Prioritized changes | The main goal of this issue is removing the already deprecated getUrlFromPath method for 8.0.0. |
Comment | File | Size | Author |
---|---|---|---|
#22 | remove_deprecated-2493697-22.patch | 1.95 KB | cilefen |
#12 | remove_deprecated-2493697-12.patch | 1.95 KB | cilefen |
remove_url_from_path.patch | 1.95 KB | JeroenT | |
Comments
Comment #1
JeroenTComment #4
umarzaffer CreditAttribution: umarzaffer at Srijan | A Material+ Company commentedComment #5
umarzaffer CreditAttribution: umarzaffer at Srijan | A Material+ Company commentedComment #6
xjmNice work! Since this is deprecated for 8.0.0 already, it's prioritized to remove it during the beta per https://www.drupal.org/core/beta-changes. (Keep in mind that's only code already deprecated for 8.0.0 before the beta.) It would be good to document this in the summary with a beta evaluation as @umarzaffer suggested with the issue tag.
We do need a change record for this as I didn't find an existing one. It would be best to update an existing change record since the method is already deprecated. There should already be a change record from the URL generation changes; try searching for that and even doing a
git blame
on the line with the@deprecated
to look for issues that introduced it. Setting "Needs work" for that.Also a suggestion for @umarzaffer: When you set an issue to RTBC, you should add a comment explaining what you did to review the patch and why you believe it's RTBC. Thanks!
Comment #7
JeroenTComment #8
JeroenTComment #9
JeroenT@xjm,
This is the issue where this method was marked deprecated: #2470569: Mark \Drupal\Core\Template\TwigExtension::getUrlFromPath() as deprecated.
How about adding it to this change record? Drupal URL generation is now done using routing system's UrlGenerator instead of url()
Comment #10
umarzaffer CreditAttribution: umarzaffer at Srijan | A Material+ Company commented@xjm, noted.
Comment #11
JeroenTComment #12
cilefen CreditAttribution: cilefen commentedIt needed a reroll.
Comment #13
cilefen CreditAttribution: cilefen commented@JeroenT Since this is a twig extension, I would make it its own change record.
Comment #14
cilefen CreditAttribution: cilefen commentedOh, maybe #9 is the way to go, considering #6.
Comment #15
JeroenTCoupled this issue to the following change record: Drupal URL generation is now done using routing system's UrlGenerator instead of url().
Comment #16
cilefen CreditAttribution: cilefen commentedWould it be appropriate to add twig-based example to the change record?
Comment #17
JeroenT@cilefen,
Something like this? :
Creating an URL from a route name:
Creating an URL from a route name with parameters.
Comment #18
cilefen CreditAttribution: cilefen commentedAlso do the "before this change" section.
Comment #19
JeroenT@cilefen, thanks.
So I should add something like this?
Creating an URL from a route name:
before this change:
{{ url_from_path('user') }}
After:
{{ url('user.page') }}
Creating an URL from a route name with parameters.
Before this change:
{{ url_from_path('user/1') }}
After:
{{ url('entity.user.edit_form', {'user': '1'}) }}
Comment #20
JeroenTMade changes to CR: Drupal URL generation is now done using routing system's UrlGenerator instead of url()
and added:
Creating an URL from a route name:
before this change:
{{ url_from_path('user') }}
After:
{{ url('user.page') }}
Creating an URL from a route name with parameters.
Before this change:
{{ url_from_path('user/1') }}
After:
{{ url('entity.user.edit_form', {'user': '1'}) }}
Comment #21
Mile23Needs a reroll.
Helpful how-to here: https://www.drupal.org/patch/reroll
Comment #22
cilefen CreditAttribution: cilefen commentedComment #23
cilefen CreditAttribution: cilefen commentedRe #20: I made a new draft record for this change only because it didn't make sense to me at the end of the other one and I couldn't integrate it cleanly.
https://www.drupal.org/node/2556847
Comment #24
Mile23Yay green. :-)
The single-purpose change record is better, too.
Comment #25
alexpottCommitted bf5ee20 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation the issue summary.