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.

Remaining tasks

User interface changes

API changes

Comments

dawehner’s picture

At least url_from_path() has to be replace by something using the UnroutedUriAssembler

Cottser’s picture

Issue tags: +Twig
Cottser’s picture

I 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!

dawehner’s picture

I would vote to wait for #2346189: Denormalizing paths into route names/parameters is brittle / broken so we know what we actually want.

dawehner’s picture

At least we will have $url->__toString() so just print them out would already work.

dawehner’s picture

We should collect what kind of parts we do want to support? Here is a list which I think we should support:

  • Printing out a URL object, as if it would be a string ... we have support for that
  • Use the URL object in link(), so link(text, url) works fine
  • Add support to create a URL object, so support something like
    {%
    url = url("route_name", {key: value}) // OR url_routed("route_name", {key: value})
    url = url_unrouted("base://....")
    %}
    
  • Maybe keep link(text, route_name, route_parameters), but we also skipped to support something similar on the PHP side of things

Let's collect them in the IS and get some momentum on all the supported ways.

dawehner’s picture

Priority: Critical » Major
Related issues: +#2168231: Twig Functions needed in templates

It is already possible to provide a URL, its just not pleasant.

This issue is certainly major, but not critical

catch’s picture

Category: Bug report » Task

This is a task. Also adding #2569041: Figure out what to do about attribute filtering in Twig as a related issue.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joelpittet’s picture

I 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.

tim.plunkett’s picture

Priority: Major » Normal

Url objects work fine. Additional support sounds non-major or feature-y to me

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.