Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I would like to add support for language option in drupal_url
function. So the usage would look like
{{ drupal_url('/node/1', {'language': 'en'}) }}
Comment | File | Size | Author |
---|---|---|---|
#4 | add-language-support-3040238-4.patch | 667 bytes | Peter Törnstrand |
#2 | add-language-support-3040238-1.patch | 667 bytes | Peter Törnstrand |
Comments
Comment #2
Peter Törnstrand CreditAttribution: Peter Törnstrand at Happiness commentedComment #3
Chi CreditAttribution: Chi for DXPR commentedI think the option name should be
langcode
instead. It will be aligned with Drupal core naming conventions.Also it would prevent possible BC break as some sites may pass language object to templates and use it in this function.
Drupal core has at least one Twig template which is supplied with language variable.
https://github.com/drupal/drupal/blob/8.6.12/core/themes/stable/template...
Comment #4
Peter Törnstrand CreditAttribution: Peter Törnstrand at Happiness commentedChanges key from
language
tolangcode
.Syntax would then be
{{ drupal_url('/node/1', {'langcode': 'en'}) }}
Comment #5
Chi CreditAttribution: Chi for DXPR commentedComment #7
Chi CreditAttribution: Chi for DXPR commentedThanks.