function token_custom_type_save in Custom Tokens 7.2
Save a custom type.
Parameters
array $type: The custom type to save.
1 call to token_custom_type_save()
- token_custom_type_edit_form_submit in ./
token_custom.admin.inc - Submit callback for token_custom_type_edit_form.
File
- ./
token_custom.module, line 259 - 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_type_save($type) {
if (!is_object($type)) {
$type = (object) $type;
}
if ($type->machine_name == TOKEN_CUSTOM_DEFAULT_TYPE) {
return FALSE;
}
$types = token_custom_type_load_multiple();
$types[$type->machine_name] = $type;
variable_set('token_custom_types', $types);
return $type;
}