Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
social
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
social
Commits
b7397387
Commit
b7397387
authored
1 year ago
by
sv
Committed by
Taras Kruts
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3380523
by SV: Take into account a "Prefered Language" during processing cta_button token
parent
f03d198d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/custom/activity_creator/src/ActivityFactory.php
+8
-8
8 additions, 8 deletions
modules/custom/activity_creator/src/ActivityFactory.php
modules/social_features/social_group/social_group.tokens.inc
+1
-1
1 addition, 1 deletion
modules/social_features/social_group/social_group.tokens.inc
with
9 additions
and
9 deletions
modules/custom/activity_creator/src/ActivityFactory.php
+
8
−
8
View file @
b7397387
...
...
@@ -505,8 +505,12 @@ class ActivityFactory extends ControllerBase {
$token_options
=
$message_template
->
getSetting
(
'token options'
,
[]);
if
(
!
empty
(
$token_options
[
'token replace'
]))
{
$options
=
[
'langcode'
=>
!
empty
(
$langcode
)
?
$langcode
:
''
,
'clear'
=>
!
empty
(
$token_options
[
'clear'
]),
];
// Token should be processed.
$output
=
$this
->
processTokens
(
$output
,
!
empty
(
$token_options
[
'clear'
])
,
$message
);
$output
=
$this
->
processTokens
(
$output
,
$options
,
$message
);
}
return
$output
;
...
...
@@ -559,8 +563,8 @@ class ActivityFactory extends ControllerBase {
*
* @param array $output
* The templated text to be replaced.
* @param
bool $clear
*
Determine if unused token should be cleared
.
* @param
array $options
*
Token options
.
* @param \Drupal\message\Entity\Message $message
* Message object.
*
...
...
@@ -568,11 +572,7 @@ class ActivityFactory extends ControllerBase {
* The output with placeholders replaced with the token value,
* if there are indeed tokens.
*/
protected
function
processTokens
(
array
$output
,
$clear
,
Message
$message
)
{
$options
=
[
'clear'
=>
$clear
,
];
protected
function
processTokens
(
array
$output
,
array
$options
,
Message
$message
)
{
$bubbleable_metadata
=
new
BubbleableMetadata
();
foreach
(
$output
as
$key
=>
$value
)
{
if
(
is_string
(
$value
))
{
...
...
This diff is collapsed.
Click to expand it.
modules/social_features/social_group/social_group.tokens.inc
+
1
−
1
View file @
b7397387
...
...
@@ -190,7 +190,7 @@ function social_group_tokens_alter(array &$replacements, array $context, Bubblea
case
'join_to_group'
:
if
(
isset
(
$context
[
'tokens'
][
'cta_button'
]))
{
$link
=
Url
::
fromRoute
(
'view.group_members.page_group_members'
,
[
'group'
=>
$group_content
->
getGroup
()
->
id
()]);
$cta_button
=
$email_token_services
->
getCtaButton
(
$link
,
new
TranslatableMarkup
(
'See all members'
));
$cta_button
=
$email_token_services
->
getCtaButton
(
$link
,
new
TranslatableMarkup
(
'See all members'
,
[],
$context
[
'options'
]
));
$replacements
[
$context
[
'tokens'
][
'cta_button'
]]
=
\Drupal
::
service
(
'renderer'
)
->
renderPlain
(
$cta_button
);
}
...
...
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