Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drupal Environment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Composer
plugin
Drupal Environment
Commits
466f816c
Commit
466f816c
authored
1 year ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Add patch for token module
parent
2c540452
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!173
Merging develop into main
Pipeline
#1203507
passed with warnings
1 year ago
Stage: build
Stage: validate
Stage: release
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
patches/d10-3.json
+3
-0
3 additions, 0 deletions
patches/d10-3.json
patches/d10.json
+3
-0
3 additions, 0 deletions
patches/d10.json
patches/d10/3437013.diff
+62
-0
62 additions, 0 deletions
patches/d10/3437013.diff
patches/d9.json
+3
-0
3 additions, 0 deletions
patches/d9.json
with
71 additions
and
0 deletions
patches/d10-3.json
+
3
−
0
View file @
466f816c
...
...
@@ -241,6 +241,9 @@
"drupal/title"
:
{
"#3172331 D9 compatibility"
:
"https://www.drupal.org/files/issues/2021-08-24/D9-compatibility_3172331.patch"
},
"drupal/token"
:
{
"#3437013 Referrer tokens"
:
"https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3437013.diff"
},
"drupal/uikitty"
:
{
"#3149175 Drupal 9"
:
"https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3149175.diff"
,
"#local Drupal 10"
:
"https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/uikitty-d10.patch"
...
...
This diff is collapsed.
Click to expand it.
patches/d10.json
+
3
−
0
View file @
466f816c
...
...
@@ -234,6 +234,9 @@
"drupal/title"
:
{
"#3172331 D9 compatibility"
:
"https://www.drupal.org/files/issues/2021-08-24/D9-compatibility_3172331.patch"
},
"drupal/token"
:
{
"#3437013 Referrer tokens"
:
"https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3437013.diff"
},
"drupal/uikitty"
:
{
"#3149175 Drupal 9"
:
"https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3149175.diff"
,
"#local Drupal 10"
:
"https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/uikitty-d10.patch"
...
...
This diff is collapsed.
Click to expand it.
patches/d10/3437013.diff
0 → 100644
+
62
−
0
View file @
466f816c
diff --git a/token.tokens.inc b/token.tokens.inc
index f8925aa61c359a1983c3dd9fcf2dba5e798c8035..6a6f9b88eccf877fcda3ddb4cc64b924090c9c68 100644
--- a/token.tokens.inc
+++ b/token.tokens.inc
@@ -339,6 +339,11 @@
function token_token_info() {
'description' => t('The URL of the current page.'),
'type' => 'url',
];
+ $info['tokens']['current-page']['referrer-url'] = [
+ 'name' => t('Referrer URL'),
+ 'description' => t('The URL of the current page referrer.'),
+ 'type' => 'url',
+ ];
$info['tokens']['current-page']['page-number'] = [
'name' => t('Page number'),
'description' => t('The page number of the current page when viewing paged lists.'),
@@ -348,6 +353,11 @@
function token_token_info() {
'description' => t('The value of a specific query string field of the current page.'),
'dynamic' => TRUE,
];
+ $info['tokens']['current-page']['referrer-query'] = [
+ 'name' => t('Referrer query string value'),
+ 'description' => t('The value of a specific query string field of the current page referrer.'),
+ 'dynamic' => TRUE,
+ ];
$info['tokens']['current-page']['interface-language'] = [
'name' => t('Interface language'),
'description' => t('The active user interface language.'),
@@ -904,6 +914,10 @@
function token_tokens($type, array $tokens, array $data, array $options, Bubblea
}
break;
+ case 'referrer-url':
+ $replacements[$original] = \Drupal::request()->headers->get('referer')
+ break;
+
case 'page-number':
if ($page = $request->query->get('page')) {
// @see PagerDefault::execute()
@@ -952,6 +966,22 @@
function token_tokens($type, array $tokens, array $data, array $options, Bubblea
}
}
+ // [current-page:referrer-query] dynamic tokens.
+ if ($query_tokens = \Drupal::token()->findWithPrefix($tokens, 'referrer-query')) {
+ if ($referrer = \Drupal::request()->headers->get('referer')) {
+ if ($query = parse_url($referrer, PHP_URL_QUERY)) {
+ $queryArgs = [];
+ foreach (explode('&', $query) as $item) {
+ [$key, $value] = explode('=', $item);
+ $queryArgs[$key] = urldecode($value);
+ }
+ foreach ($query_tokens as $name => $original) {
+ $replacements[$original] = $queryArgs[$name] ?? '';
+ }
+ }
+ }
+ }
+
// Chained token relationships.
if ($url_tokens = \Drupal::token()->findWithPrefix($tokens, 'url')) {
$url = NULL;
This diff is collapsed.
Click to expand it.
patches/d9.json
+
3
−
0
View file @
466f816c
...
...
@@ -238,6 +238,9 @@
"drupal/title"
:
{
"#3172331 D9 compatibility"
:
"https://www.drupal.org/files/issues/2021-08-24/D9-compatibility_3172331.patch"
},
"drupal/token"
:
{
"#3437013 Referrer tokens"
:
"https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3437013.diff"
},
"drupal/uikitty"
:
{
"#3149175 Drupal 9"
:
"https://git.drupalcode.org/project/uikitty/-/merge_requests/2.diff"
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment