TokenEntityMapperInterface.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Drupal\token;
  3. interface TokenEntityMapperInterface {
  4. /**
  5. * Return an array of entity type to token type mappings.
  6. *
  7. * @return array
  8. * An array of mappings with entity type mapping to token type.
  9. */
  10. public function getEntityTypeMappings();
  11. /**
  12. * Return the entity type of a particular token type.
  13. *
  14. * @param string $token_type
  15. * The token type for which the mapping is returned.
  16. * @param bool $fallback
  17. * (optional) Defaults to FALSE. If true, the same $value is returned in
  18. * case the mapping was not found.
  19. *
  20. * @return string
  21. * The entity type of the token type specified.
  22. *
  23. * @see token_entity_info_alter()
  24. * @see http://drupal.org/node/737726
  25. */
  26. function getEntityTypeForTokenType($token_type, $fallback = FALSE);
  27. /**
  28. * Return the token type of a particular entity type.
  29. *
  30. * @param string $entity_type
  31. * The entity type for which the mapping is returned.
  32. * @param bool $fallback
  33. * (optional) Defaults to FALSE. If true, the same $value is returned in
  34. * case the mapping was not found.
  35. *
  36. * @return string
  37. * The token type of the entity type specified.
  38. *
  39. * @see token_entity_info_alter()
  40. * @see http://drupal.org/node/737726
  41. */
  42. function getTokenTypeForEntityType($entity_type, $fallback = FALSE);
  43. /**
  44. * Resets metadata describing token and entity mappings.
  45. */
  46. public function resetInfo();
  47. }