Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 296564

Let twig recover from route not found or missing parameters when using the url function

$
0
0

Problem/Motivation

On #3041924: [META] Convert hook_help() module overview text to topics we are converting our hook_help() text into Help Topics (and making improvements). As part of that effort, on #3072312: Review/fix/delete existing help topics, we are going through the initial topics we added as proof of concept when the original Help Topics patch went in. We came across a problem that is sort of a regression from things we could do in hook_help() that we can't currently do in a help topic.

In hook_help(), we could have code like this, to make a link only if another module exists:

$url = (\Drupal::moduleHandler()->moduleExists('block')) ? Url::fromRoute('help.page', ['name' => 'block'])->toString() : '#';

But we don't have a way to do that in a Twig template. (At least, not that I know of?)

As a note, we actually don't even have a good way to make URLs at all in Twig -- see this related issue: #2996305: Add support for the url() function to twig {%trans%}

Proposed resolution

Let twig's url function recover from route not found and missing parameter exceptions.

Remaining tasks

Figure out how to do this, and make a patch.

User interface changes

None.

API changes

New Twig functionality will be added. TBD.

Data model changes

None.

Release notes snippet

TBD.


Viewing all articles
Browse latest Browse all 296564

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>