You are here

function linkit_extract_tokens in Linkit 7.2

Same name and namespace in other branches
  1. 7.3 plugins/export_ui/linkit_profiles.inc \linkit_extract_tokens()

Extract tokens that can be used by the $type.

1 call to linkit_extract_tokens()
LinkitPluginEntity::buildSettingsForm in plugins/linkit_plugins/linkit-plugin-entity.class.php
Generate a settings form for this handler. Uses the standard Drupal FAPI. The element will be attached to the "data" key.

File

./linkit.module, line 970
Main file for linkit module.

Code

function linkit_extract_tokens($type) {

  // token_info() has it own static cache, so we can call it as we like.
  $tokens = token_info();

  // If no tokens for the type exists, return an empty array.
  if (!isset($tokens['tokens'][$type])) {
    return array();
  }
  $available_tokens = array();
  foreach ($tokens['tokens'][$type] as $token_key => $token) {
    $available_tokens[] = '[' . $type . ':' . $token_key . ']';
  }
  return $available_tokens;
}