Problem/Motivation
There are a couple of usecases for generating links/urls.
- You want to generate an URL to a path controlled by drupal:
(new URL($route_name))->toString()
- You want to generate an external URL, just
(new URL($external_url))->toString()
- Generate a link with a given route:
LinkGeneratorInterface->generate($text, $route_name)
- Generate a ink to an external path, path without a route:
l()
Proposed resolution
Let's reuse most of the logic of the link generator for the l method(). Introduces LinkGeneratorInterface->generateFromPath($path)