function linkit_extract_tokens in Linkit 7.3
Same name and namespace in other branches
- 7.2 linkit.module \linkit_extract_tokens()
Extract tokens that can be used by the $type.
Parameters
$type: A string with the entity type.
2 calls to linkit_extract_tokens()
- LinkitSearchPluginEntity::buildSettingsForm in plugins/
linkit_search/ entity.class.php - Overrides LinkitSearchPlugin::buildSettingsForm().
- LinkitSearchPluginTaxonomy_term::buildSettingsForm in plugins/
linkit_search/ taxonomy_term.class.php - Overrides LinkitSearchPlugin::buildSettingsForm().
File
- plugins/
export_ui/ linkit_profiles.inc, line 512
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;
}