You are here

protected function EntityPager::detokenize in Entity Pager 8

Same name and namespace in other branches
  1. 2.0.x src/EntityPager.php \Drupal\entity_pager\EntityPager::detokenize()

Replaces all tokens in provided string.

Supports the current entity from the request object.

Parameters

string $string: The string to de-tokenize.

\Drupal\Core\Entity\EntityInterface|null $entity: The entity to use for de-tokenization.

Return value

string The de-tokenized string.

2 calls to EntityPager::detokenize()
EntityPager::getAllLink in src/EntityPager.php
Returns a Display All link render array.
EntityPager::getLink in src/EntityPager.php
Returns an Entity pager link.

File

src/EntityPager.php, line 278

Class

EntityPager
Entity pager object.

Namespace

Drupal\entity_pager

Code

protected function detokenize($string, $entity) {
  if (is_null($entity)) {
    $entity = $this
      ->getEntity();
  }
  $data = [];
  if ($entity instanceof EntityInterface) {
    $data[$entity
      ->getEntityTypeId()] = $entity;
  }
  return $this->token
    ->replace($string, $data, [
    'clear' => TRUE,
  ]);
}