protected static function MailWithTypeItem::mailTypeInUse in CRM Core 8.2
Checks if any of the mail types are in use.
Parameters
string $entity_type: ID of the entity type field belongs to.
string $field_name: Name of the field.
array $email_types: Array of mail type keys to check against.
Return value
bool
1 call to MailWithTypeItem::mailTypeInUse()
- MailWithTypeItem::validateMailTypes in modules/
crm_core_contact/ src/ Plugin/ Field/ FieldType/ MailWithTypeItem.php - #element_validate callback for possible mail types.
File
- modules/
crm_core_contact/ src/ Plugin/ Field/ FieldType/ MailWithTypeItem.php, line 183
Class
- MailWithTypeItem
- Defines the 'mail_with_type' field type.
Namespace
Drupal\crm_core_contact\Plugin\Field\FieldTypeCode
protected static function mailTypeInUse($entity_type, $field_name, $email_types) {
if ($email_types) {
$factory = \Drupal::service('entity.query');
$result = $factory
->get($entity_type)
->condition($field_name . '.type', $email_types, 'IN')
->count()
->accessCheck(FALSE)
->range(0, 1)
->execute();
if ($result) {
return TRUE;
}
}
return FALSE;
}