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.
Problem/Motivation
Now that we got the beta out, we can realize finally what we forgot.
One thing we forgot is to support url objects, and urls using the UnroutedUrlAssembler.
This should be as similar as possible to the usages on the module system.
Proposed resolution
Before
<a href="url("route_name", {})
<a href="url_from_path("a-path", {})
{% link("text", "route_name") %}
{% link("text", url_object) %}
TODO: We still need the solutions.
Comments
Comment #1
dawehnerAt least url_from_path() has to be replace by something using the UnroutedUriAssembler
Comment #2
star-szrComment #3
star-szrI think we need a bit more of an issue summary here, I'm not sure how we can move forward with this or what is being proposed. Thanks!
Comment #4
dawehnerI would vote to wait for #2346189: Denormalizing paths into route names/parameters is brittle / broken so we know what we actually want.
Comment #5
dawehnerAt least we will have $url->__toString() so just print them out would already work.
Comment #6
dawehnerWe should collect what kind of parts we do want to support? Here is a list which I think we should support:
link()
, solink(text, url)
works finelink(text, route_name, route_parameters)
, but we also skipped to support something similar on the PHP side of thingsLet's collect them in the IS and get some momentum on all the supported ways.
Comment #7
dawehnerIt is already possible to provide a URL, its just not pleasant.
This issue is certainly major, but not critical
Comment #8
catchThis is a task. Also adding #2569041: Figure out what to do about attribute filtering in Twig as a related issue.
Comment #11
joelpittetI agree there is some work needed here. The issue summary needs to show what we have and what we need to make the URL objects more useful in templates.
Comment #12
tim.plunkettUrl objects work fine. Additional support sounds non-major or feature-y to me