You are here

public static function TransactorHandler::getTokenContextFromEntityTypeId in Transaction 8

Guess the token context for a entity type.

Parameters

string $entity_type_id: The entity type ID.

Return value

string The token context for the given entity type ID.

1 call to TransactorHandler::getTokenContextFromEntityTypeId()
TransactionOperationForm::buildForm in src/Form/TransactionOperationForm.php
Form constructor.

File

src/TransactorHandler.php, line 322

Class

TransactorHandler
Transactor entity handler.

Namespace

Drupal\transaction

Code

public static function getTokenContextFromEntityTypeId($entity_type_id) {
  switch ($entity_type_id) {
    case 'taxonomy_term':

      // Taxonomy term token type doesn't match the entity type's machine
      // name.
      $context = 'term';
      break;
    case 'taxonomy_vocabulary':

      // Taxonomy vocabulary token type doesn't match the entity type's
      // machine name.
      $context = 'vocabulary';
      break;
    default:
      $context = $entity_type_id;
      break;
  }
  return $context;
}