Created
August 15, 2017 17:59
-
-
Save chriscalip/58afae770105559e0f01cb6d8afc3972 to your computer and use it in GitHub Desktop.
Drupal 8, Is it possible to override current-user for token replace purposes?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$token = Drupal::token(); | |
$text = 'New [node:content-type] created: [node:title] [current-user:display-name]'; | |
$node = node_load(80044); | |
$user = user_load(2); | |
$token->replace($text, ['node' => $node, 'current-user' => $user]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment