You are here

public function TokenResolverInterface::replace in FillPDF 8.4

Same name and namespace in other branches
  1. 5.0.x src/TokenResolverInterface.php \Drupal\fillpdf\TokenResolverInterface::replace()

Replaces all tokens in a given string with appropriate values.

This is basically a replacement for \Drupal\Core\Utility\Token::replace(), only that it resolves image tokens, applies form and field replacements after token replacement, and returns FieldMapping objects.

Parameters

string $text: An plain text string containing replaceable tokens.

\Drupal\Core\Entity\EntityInterface[][] $data: (optional) Multidimensional array of entities, keyed by entity ID and grouped by entity type.

array $options: (optional) A keyed array of settings and flags to control the token replacement process. Supported options are:

  • langcode: A language code to be used when generating locale-sensitive tokens.
  • callback: A callback function that will be used to post-process the array of token replacements after they are generated.

Return value

\Drupal\fillpdf\FieldMapping An instance of a FieldMapping.

See also

\Drupal\Core\Utility\Token::replace()

1 method overrides TokenResolverInterface::replace()
TokenResolver::replace in src/TokenResolver.php
Replaces all tokens in a given string with appropriate values.

File

src/TokenResolverInterface.php, line 37

Class

TokenResolverInterface
Provides consistent token replacement for one or multiple entity sources.

Namespace

Drupal\fillpdf

Code

public function replace($text, array $data = [], array $options = []);