You are here

function token_custom_load in Custom Tokens 7

Same name and namespace in other branches
  1. 6 token_custom.module \token_custom_load()
  2. 7.2 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

$machine_name:

Return value

object|NULL

  • The token object or null
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 182
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);
}