public function TextimageFactory::processTextString in Textimage 8.4
Same name and namespace in other branches
- 8.3 src/TextimageFactory.php \Drupal\textimage\TextimageFactory::processTextString()
Processes text string, detokenises and applies case conversion.
@todo The $case_format parameter is deprecated, remove in a future major.
Parameters
string $text: The input string containing unresolved tokens.
string $case_format: A text conversion option.
array $token_data: (optional) Token data to be passed to Token::replace.
\Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata: (optional) A BubbleableMetadata object to collect cacheability metadata from the token replacement process.
Return value
string The processed text string.
Overrides TextimageFactoryInterface::processTextString
File
- src/
TextimageFactory.php, line 135
Class
- TextimageFactory
- Provides a factory for Textimage.
Namespace
Drupal\textimageCode
public function processTextString($text, $case_format, array $token_data = [], BubbleableMetadata $bubbleable_metadata = NULL) {
// Replace any tokens in text with run-time values.
$token_data['user'] = !empty($token_data['user']) ? $token_data['user'] : $this->userStorage
->load($this->currentUser
->id());
return $this->token
->replace($text, $token_data, [], $bubbleable_metadata);
}