Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
eca
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
eca
Merge requests
!248
Issue
#3320559
: Make a token available for child processes
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3320559
: Make a token available for child processes
issue/eca-3320559:3320559-make-a-token
into
1.1.x
Overview
0
Commits
3
Pipelines
0
Changes
6
Merged
mxh
requested to merge
issue/eca-3320559:3320559-make-a-token
into
1.1.x
2 years ago
Overview
0
Commits
3
Pipelines
0
Changes
6
Expand
0
0
Merge request reports
Compare
1.1.x
version 3
1b5515a9
2 years ago
version 2
29a70306
2 years ago
version 1
784cdca2
2 years ago
1.1.x (base)
and
latest version
latest version
1b5515a9
3 commits,
2 years ago
version 3
1b5515a9
3 commits,
2 years ago
version 2
29a70306
2 commits,
2 years ago
version 1
784cdca2
1 commit,
2 years ago
6 files
+
215
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
modules/base/src/Plugin/Action/TokenSetContext.php
0 → 100644
+
64
−
0
Options
<?php
namespace
Drupal\eca_base\Plugin\Action
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Drupal\eca\Plugin\Action\ActionBase
;
use
Drupal\eca\Plugin\Action\ConfigurableActionBase
;
use
Drupal\eca\Plugin\CleanupInterface
;
use
Drupal\eca\Token\ContextDataProvider
;
/**
* Set currently defined token data to be available for any child process.
*
* @Action(
* id = "eca_token_set_context",
* label = @Translation("Token: set context"),
* description = @Translation("Set currently defined token data to be available for any child process.")
* )
*/
class
TokenSetContext
extends
ConfigurableActionBase
implements
CleanupInterface
{
/**
* The context data provider.
*
* @var \Drupal\eca\Token\ContextDataProvider
*/
protected
ContextDataProvider
$contextDataProvider
;
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
):
ActionBase
{
/** @var \Drupal\eca_base\Plugin\Action\TokenSetContext $instance */
$instance
=
parent
::
create
(
$container
,
$configuration
,
$plugin_id
,
$plugin_definition
);
$instance
->
setContextDataProvider
(
$container
->
get
(
'eca.token_data.context'
));
return
$instance
;
}
/**
* {@inheritdoc}
*/
public
function
execute
()
{
$data
=
$this
->
tokenServices
->
getTokenData
();
$this
->
contextDataProvider
->
push
(
$data
);
}
/**
* Set the context data provider.
*
* @var \Drupal\eca\Token\ContextDataProvider $provider
* The provider.
*/
public
function
setContextDataProvider
(
ContextDataProvider
$provider
):
void
{
$this
->
contextDataProvider
=
$provider
;
}
/**
* {@inheritdoc}
*/
public
function
cleanupAfterSuccessors
():
void
{
$this
->
contextDataProvider
->
pop
();
}
}
Loading