protected function ActivityFactory::processTokens in Open Social 10.2.x
Same name and namespace in other branches
- 8.9 modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 8 modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 8.2 modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 8.3 modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 8.4 modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 8.5 modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 8.6 modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 8.7 modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 8.8 modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 10.3.x modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 10.0.x modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
- 10.1.x modules/custom/activity_creator/src/ActivityFactory.php \Drupal\activity_creator\ActivityFactory::processTokens()
Replace placeholders with tokens.
Parameters
array $output: The templated text to be replaced.
bool $clear: Determine if unused token should be cleared.
\Drupal\message\Entity\Message $message: Message object.
Return value
array The output with placeholders replaced with the token value, if there are indeed tokens.
1 call to ActivityFactory::processTokens()
- ActivityFactory::getMessageText in modules/
custom/ activity_creator/ src/ ActivityFactory.php - Get message text.
File
- modules/
custom/ activity_creator/ src/ ActivityFactory.php, line 571
Class
- ActivityFactory
- Class ActivityFactory to create Activity items based on ActivityLogs.
Namespace
Drupal\activity_creatorCode
protected function processTokens(array $output, $clear, Message $message) {
$options = [
'clear' => $clear,
];
$bubbleable_metadata = new BubbleableMetadata();
foreach ($output as $key => $value) {
if (is_string($value)) {
$output[$key] = $this->token
->replace($value, [
'message' => $message,
], $options, $bubbleable_metadata);
}
else {
if (isset($value['value'])) {
$output[$key] = $this->token
->replace($value['value'], [
'message' => $message,
], $options, $bubbleable_metadata);
}
}
}
$bubbleable_metadata
->applyTo($output);
return $output;
}