You are here

function flag_token_get_list in Flag 6

Same name and namespace in other branches
  1. 5 includes/flag.token.inc \flag_token_get_list()
  2. 6.2 includes/flag.token.inc \flag_token_get_list()

This is a replacement for Token's token_get_list().

It is used only by theme_flag_token_help(), above.

This is a duplicate of the Token's function, but with a small modification: the $type parameter is now $types, allowing for listing tokens from several categories.

@todo Incorporate this feature into the Token module(?)

1 call to flag_token_get_list()
theme_flag_token_help in includes/flag.token.inc
This is a replacement for Token's theme_token_help().

File

includes/flag.token.inc, line 102
Flag module tokens support.

Code

function flag_token_get_list($types = array(
  'all',
)) {
  token_include();
  $return = array();
  foreach ($types as $type) {
    foreach (module_implements('token_list') as $module) {
      $function = $module . '_token_list';
      $result = $function($type);
      if (is_array($result)) {
        foreach ($result as $category => $tokens) {
          foreach ($tokens as $token => $title) {
            $return[$category][$token] = $title;
          }
        }
      }
    }
  }

  // For aesthetic reasons, we don't want the 'global' section to appear in
  // varying places, so let's move it to the bottom.
  if (isset($return['global'])) {
    $global = $return['global'];
    unset($return['global']);
    $return['global'] = $global;
  }
  return $return;
}