You are here

function TokenEntityMapper::getTokenTypeForEntityType in Token 8

Return the token type of a particular entity type.

Parameters

string $entity_type: The entity type for which the mapping is returned.

bool $fallback: (optional) Defaults to FALSE. If true, the same $value is returned in case the mapping was not found.

Return value

string The token type of the entity type specified.

Overrides TokenEntityMapperInterface::getTokenTypeForEntityType

See also

token_entity_info_alter()

http://drupal.org/node/737726

File

src/TokenEntityMapper.php, line 67

Class

TokenEntityMapper
Service to provide mappings between entity and token types.

Namespace

Drupal\token

Code

function getTokenTypeForEntityType($entity_type, $fallback = FALSE) {
  if (empty($this->entityMappings)) {
    $this
      ->getEntityTypeMappings();
  }
  return isset($this->entityMappings[$entity_type]) ? $this->entityMappings[$entity_type] : ($fallback ? $entity_type : FALSE);
}