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.
Copied from #2047619-15: Add a link generator service for route-based links
Might be better as a follow-up, but it would be cool if we could add a Drupal::link($text, $route, ...) for use in procedural code.
Looks great now, but I don't feel comfortable RTBC-ing myself.
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedduplicate to this issue where I posted a patch: #2078285: Add short-cut methods to the \Drupal class for generating URLs and links from routes