function crm_core_contact_type_validate_unique in CRM Core 7
Checks to see if a given contact type already exists.
Parameters
string $type: The string to match against existing types.
Return value
bool TRUE or FALSE indicating whether or not the contact type exists.
1 call to crm_core_contact_type_validate_unique()
- crm_core_contact_type_form_validate in modules/
crm_core_contact/ crm_core_contact.admin.inc - Validation callback.
File
- modules/
crm_core_contact/ crm_core_contact.module, line 774 - Provides default CRM Core Contact entities and the ability to create more.
Code
function crm_core_contact_type_validate_unique($type) {
// Look for a match of the type.
$match_id = db_query('SELECT type FROM {crm_core_contact_type} WHERE type = :type', array(
':type' => $type,
))
->fetchField();
return !$match_id;
}