1 token.inc token_get_global_token_types()

Get a list of token types that can be used without any context (global).

Return value

array An array of global token types.

File

core/includes/token.inc, line 361
Backdrop placeholder/token replacement system.

Code

function token_get_global_token_types() {
  $global_types = &backdrop_static(__FUNCTION__, array());

  if (empty($global_types)) {
    $token_info = token_get_info();
    foreach ($token_info['types'] as $type => $type_info) {
      // If the token types has not specified that 'needs-data' => TRUE, then
      // it is a global token type that will always be replaced in any context.
      if (empty($type_info['needs-data'])) {
        $global_types[] = $type;
      }
    }
  }

  return $global_types;
}