Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
recurring_events
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
recurring_events
Commits
8f6acdd5
Commit
8f6acdd5
authored
1 year ago
by
Owen Bush
Committed by
Andrii Podanenko
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add tokens from eventseries and eventinstance to registrants
parent
61067b35
No related branches found
No related tags found
1 merge request
!68
Issue #3359696: Token for eventinstance of registration
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/recurring_events_registration/recurring_events_registration.tokens.inc
+34
-0
34 additions, 0 deletions
...nts_registration/recurring_events_registration.tokens.inc
with
34 additions
and
0 deletions
modules/recurring_events_registration/recurring_events_registration.tokens.inc
+
34
−
0
View file @
8f6acdd5
...
@@ -50,6 +50,17 @@ function recurring_events_registration_token_info() {
...
@@ -50,6 +50,17 @@ function recurring_events_registration_token_info() {
'description'
=>
t
(
'The URL to delete a registrant.'
),
'description'
=>
t
(
'The URL to delete a registrant.'
),
];
];
$registrant
[
'eventinstance'
]
=
[
'name'
=>
t
(
'Registrant event instance'
),
'description'
=>
t
(
'The eventinstance associated with a registrant'
),
'type'
=>
'eventinstance'
,
];
$registrant
[
'eventseries'
]
=
[
'name'
=>
t
(
'Registrant event series'
),
'description'
=>
t
(
'The eventseries associated with a registrant'
),
'type'
=>
'eventseries'
,
];
return
[
return
[
'types'
=>
[
'types'
=>
[
'eventinstance'
=>
$eventinstance_type
,
'eventinstance'
=>
$eventinstance_type
,
...
@@ -67,6 +78,7 @@ function recurring_events_registration_token_info() {
...
@@ -67,6 +78,7 @@ function recurring_events_registration_token_info() {
* Implements hook_tokens().
* Implements hook_tokens().
*/
*/
function
recurring_events_registration_tokens
(
$type
,
$tokens
,
array
$data
,
array
$options
,
BubbleableMetadata
$bubbleable_metadata
)
{
function
recurring_events_registration_tokens
(
$type
,
$tokens
,
array
$data
,
array
$options
,
BubbleableMetadata
$bubbleable_metadata
)
{
$token_service
=
\Drupal
::
token
();
$replacements
=
[];
$replacements
=
[];
if
(
$type
==
'eventinstance'
&&
!
empty
(
$data
[
'eventinstance'
]))
{
if
(
$type
==
'eventinstance'
&&
!
empty
(
$data
[
'eventinstance'
]))
{
$event_instance
=
$data
[
'eventinstance'
];
$event_instance
=
$data
[
'eventinstance'
];
...
@@ -108,8 +120,30 @@ function recurring_events_registration_tokens($type, $tokens, array $data, array
...
@@ -108,8 +120,30 @@ function recurring_events_registration_tokens($type, $tokens, array $data, array
}
}
$replacements
[
$original
]
=
$url
;
$replacements
[
$original
]
=
$url
;
break
;
break
;
case
'eventinstance'
:
$instance
=
$registrant
->
getEventInstance
();
$bubbleable_metadata
->
addCacheableDependency
(
$instance
);
$replacements
[
$original
]
=
$instance
->
label
();
break
;
case
'eventseries'
:
$series
=
$registrant
->
getEventSeries
();
$bubbleable_metadata
->
addCacheableDependency
(
$series
);
$replacements
[
$original
]
=
$series
->
label
();
break
;
}
}
}
}
if
(
$instance_tokens
=
$token_service
->
findWithPrefix
(
$tokens
,
'eventinstance'
))
{
$instance
=
$registrant
->
getEventInstance
();
$replacements
+=
$token_service
->
generate
(
'eventinstance'
,
$instance_tokens
,
[
'eventinstance'
=>
$instance
],
$options
,
$bubbleable_metadata
);
}
if
(
$series_tokens
=
$token_service
->
findWithPrefix
(
$tokens
,
'eventseries'
))
{
$series
=
$registrant
->
getEventSeries
();
$replacements
+=
$token_service
->
generate
(
'eventseries'
,
$series_tokens
,
[
'eventseries'
=>
$series
],
$options
,
$bubbleable_metadata
);
}
}
}
return
$replacements
;
return
$replacements
;
}
}
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