function token_custom_load in Custom Tokens 7.2
Same name and namespace in other branches
- 6 token_custom.module \token_custom_load()
- 7 token_custom.module \token_custom_load()
Loads an individual token from the database.
Calls on the main loading function that maintains a static cache of the loaded tokens.
Parameters
string $machine_name: The token's machine name.
Return value
object|NULL The token object or null.
1 call to token_custom_load()
- token_custom_token_render in ./
token_custom.module - Evaluates a string using the given token.
1 string reference to 'token_custom_load'
- token_custom_edit_form in ./
token_custom.admin.inc - The add/edit token form
File
- ./
token_custom.module, line 357 - It gives the user the ability to create custom tokens using PHP code for specific replacements that can improve other modules relying on the token Drupal 7 core API.
Code
function token_custom_load($machine_name = NULL) {
if (empty($machine_name) || !is_string($machine_name)) {
return NULL;
}
$tokens = token_custom_load_multiple(array(
$machine_name,
));
return array_shift($tokens);
}