You are here

function token_custom_delete in Custom Tokens 7

Same name and namespace in other branches
  1. 7.2 token_custom.module \token_custom_delete()

Delete an individual token from the database.

Parameters

$machine_name:

1 call to token_custom_delete()
token_custom_delete_confirm_form_submit in ./token_custom.admin.inc

File

./token_custom.module, line 261
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_delete($machine_name) {
  if (!is_string($machine_name) || empty($machine_name)) {
    return FALSE;
  }
  $return = db_delete('token_custom')
    ->condition('machine_name', $machine_name)
    ->execute();

  //Clear the Token module's token cache table.
  if (module_exists('token')) {
    token_clear_cache();
  }
  return $return;
}