You are here

interface TokenInterface in Doubleclick for Publishers (DFP) 8

Interface for the DFP token service.

Hierarchy

Expanded class hierarchy of TokenInterface

All classes that implement TokenInterface

4 files declare their use of TokenInterface
DfpHtmlResponseAttachmentsProcessorTest.php in tests/src/Unit/DfpHtmlResponseAttachmentsProcessorTest.php
Contains \Drupal\Tests\dfp\Unit\DfpHtmlResponseAttachmentsProcessorTest.
TagView.php in src/View/TagView.php
Contains \Drupal\dfp\View\TagView.
TagViewBuilder.php in src/View/TagViewBuilder.php
Contains \Drupal\dfp\View\TagViewBuilder.
TagViewTest.php in tests/src/Unit/View/TagViewTest.php
Contains \Drupal\Tests\dfp\Unit\View\TagViewTest.

File

src/TokenInterface.php, line 16
Contains \Drupal\dfp\TokenInterface.

Namespace

Drupal\dfp
View source
interface TokenInterface {

  /**
   * Replaces all tokens in a given string with appropriate values.
   *
   * @param string $text
   *   An HTML string containing replaceable tokens.
   * @param \Drupal\dfp\View\TagView $tag
   *   (optional) An TagView object that merges values of the Tag and global
   *   settings. Defaults to NULL.
   * @param array $options
   *   (optional) A keyed array of settings and flags to control the token
   *   replacement process.
   * @param \Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata
   *   (optional) An object to which static::generate() and the hooks and
   *   functions that it invokes will add their required bubbleable metadata.
   *   Defaults to NULL.
   *
   * @return string
   *   The token result is the entered HTML text with tokens replaced. The
   *   caller is responsible for choosing the right escaping / sanitization. If
   *   the result is intended to be used as plain text, using
   *   PlainTextOutput::renderFromHtml() is recommended. If the result is just
   *   printed as part of a template relying on Twig autoescaping is possible,
   *   otherwise for example the result can be put into #markup, in which case
   *   it would be sanitized by Xss::filterAdmin().
   *
   * @see \Drupal\Core\Utility\Token::replace()
   */
  public function replace($text, TagView $tag = NULL, array $options = [], BubbleableMetadata $bubbleable_metadata = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
TokenInterface::replace public function Replaces all tokens in a given string with appropriate values. 1