You are here

protected function TokenReplacer::recursiveTokenUseDetected in Advanced Entity Tokens 2.x

Determines if recursive token use has been detected.

Parameters

string $entity_type_id: The entity type ID.

string $entity_type_key: The entity type key (e.g. "nid" for nodes)

string $entity_id: The entity's ID.

Return value

bool TRUE if yes; FALSE otherwise.

1 call to TokenReplacer::recursiveTokenUseDetected()
TokenReplacer::getReplacementsForTokenType in src/TokenReplacer.php
Fetches token replacements for specific token types.

File

src/TokenReplacer.php, line 309

Class

TokenReplacer
Class TokenReplacer.

Namespace

Drupal\aet

Code

protected function recursiveTokenUseDetected(string $entity_type_id, string $entity_type_key, $entity_id) {

  // Check if the entity to load is currently being viewed or if the
  // the rendered token origins from itself.
  if ($this
    ->entityIsCurrentPage($entity_id, $entity_type_key) || $this
    ->entityIsBeingViewed($entity_type_id, $entity_type_key, $entity_id)) {
    $this->logger
      ->warning(t('Recursive token use detected.'));
    return TRUE;
  }
  return FALSE;
}