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.
See https://www.drupal.org/node/2614344 for details.
Comment | File | Size | Author |
---|---|---|---|
#10 | token-url-related-deprecates-2932272-10-D8.patch | 9.58 KB | Matroskeen |
|
Comments
Comment #2
MatroskeenComment #3
MatroskeenPatch is attached.
Let's run the tests.
Comment #5
Berdirurl() returns a string and falls back to empty if not set. toUrl() returns a Url object on which you need to call toString() and it can throw an exception. Here in the tests not an issue but we need to be careful with the actual hook implementations.
Comment #6
MatroskeenThanks for the review, I didn't notice that.
Updated patch is attached. Some local tests were failed but they look not related to these changes.
Comment #8
BerdirDo we already only expose the url token for entity types that have a canonical link template? If not then we should add a hasLinkTemplate('canonical') around it to prevent an exception when using that on an entity type that has no canonical route. And possibly also an !$entity->isNew(), imagine a node:url token being used on a node preview for example.
Comment #9
MatroskeenI tested both scenarios (empty link template and new entity) with my custom entity.
I can confirm that in both we will have an exception.
Here is an updated patch with extra conditions.
I also passed
'canonical'
totoUrl()
method because entity types may override it and set another default value.Comment #10
MatroskeenAdded correct patch.
Comment #12
BerdirThanks, committed.