You are here

function token_custom_delete in Custom Tokens 7.2

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

Delete an individual token from the database.

Parameters

string $machine_name: The token's machine name.

Return value

bool|object The deleted token object or false on error.

1 call to token_custom_delete()
token_custom_delete_confirm_form_submit in ./token_custom.admin.inc
Delete token form submit callback.

File

./token_custom.module, line 441
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;
}