function crm_core_relationship_ui_type_delete_confirm in CRM Core 8.3
Same name and namespace in other branches
- 8 modules/crm_core_relationship_ui/crm_core_relationship_ui.admin.inc \crm_core_relationship_ui_type_delete_confirm()
- 8.2 modules/crm_core_relationship_ui/crm_core_relationship_ui.admin.inc \crm_core_relationship_ui_type_delete_confirm()
- 7 modules/crm_core_relationship_ui/crm_core_relationship_ui.admin.inc \crm_core_relationship_ui_type_delete_confirm()
Menu callback; deletes a single relation type.
This function is originally copied from relation_type_delete_confirm from relation.admin.inc.
1 string reference to 'crm_core_relationship_ui_type_delete_confirm'
- crm_core_relationship_ui_menu in modules/
crm_core_relationship_ui/ crm_core_relationship_ui.module - Implements hook_menu().
File
- modules/
crm_core_relationship_ui/ crm_core_relationship_ui.admin.inc, line 258 - CRM Core Relationship UI Admin pages.
Code
function crm_core_relationship_ui_type_delete_confirm($form, &$form_state, $relation_type) {
_crm_core_relationship_ui_type_set_breadcrumb();
$form['relation_type'] = [
'#type' => 'value',
'#value' => $relation_type->relation_type,
];
$form['label'] = [
'#type' => 'value',
'#value' => $relation_type->label,
];
$message = t('Are you sure you want to delete the %label relationship type?', [
'%label' => $relation_type->label,
]);
$caption = '';
$num_relations = relation_query()
->propertyCondition('relation_type', $relation_type->relation_type)
->count()
->execute();
if ($num_relations) {
$caption .= '<p>' . format_plural($num_relations, 'The %label relation type is used by 1 relation on your site. If you remove this relation type, you will not be able to edit %label relations and they may not display correctly.', 'The %label relation type is used by @count relations on your site. If you remove %label, you will not be able to edit %label relations and they may not display correctly.', [
'%label' => $relation_type->label,
'@count' => $num_relations,
]) . '</p>';
}
$caption .= '<p>' . t('This action cannot be undone.') . '</p>';
return confirm_form($form, $message, 'admin/structure/crm-core/relationship-types', $caption, t('Delete'));
}