* and format for use with buildProfile. This is the SQL analog of
* formatUFFields().
*
- * @param mix $id
+ * @param int $id
* The id of the UF group or ids of ufgroup.
* @param bool|int $register are we interested in registration fields
* @param int $action
*
*/
public static function del($id) {
+ CRM_Utils_Hook::pre('delete', 'UFGroup', $id);
+
//check whether this group contains any profile fields
$profileField = new CRM_Core_DAO_UFField();
$profileField->uf_group_id = $id;
$group = new CRM_Core_DAO_UFGroup();
$group->id = $id;
$group->delete();
+
+ CRM_Utils_Hook::post('delete', 'UFGroup', $id, $group);
return 1;
}
* @param array $params
* Reference array contains the values submitted by the form.
* @param array $ids
- * Reference array contains the id.
+ * Deprecated array.
*
*
* @return object
*/
public static function add(&$params, $ids = []) {
+ if (empty($params['id']) && !empty($ids['ufgroup'])) {
+ $params['id'] = $ids['ufgroup'];
+ CRM_Core_Error::deprecatedWarning('ids parameter is deprecated');
+ }
$fields = [
'is_active',
'add_captcha',
if (!empty($params['group_type']) && is_array($params['group_type'])) {
$params['group_type'] = implode(',', $params['group_type']);
}
+
+ $hook = empty($params['id']) ? 'create' : 'edit';
+ CRM_Utils_Hook::pre($hook, 'UFGroup', ($params['id'] ?? NULL), $params);
+
$ufGroup = new CRM_Core_DAO_UFGroup();
$ufGroup->copyValues($params);
$ufGroup->save();
}
+ CRM_Utils_Hook::post($hook, 'UFGroup', $ufGroup->id, $ufGroup);
+
return $ufGroup;
}
CRM_Contact_Form_Edit_TagsAndGroups::buildQuickForm($form, $contactId,
CRM_Contact_Form_Edit_TagsAndGroups::GROUP,
TRUE, $required,
- $title, NULL, $name
+ $title, NULL, $name, 'checkbox', TRUE
);
}
elseif ($fieldName === 'tag') {