/** * Check whether a profile is valid combination of * required and/or optional profile types * * @param array $required * Array of types those are required. * @param array $optional * Array of types those are optional. * * @return array * associative array of profiles */ public static function getValidProfiles($required, $optional = NULL) { if (!is_array($required) || empty($required)) { return NULL; } $profiles = array(); $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, NULL, 'civicrm_uf_group', $ufGroups, $ufGroups); foreach ($ufGroups as $id => $title) { $type = CRM_Core_BAO_UFField::checkValidProfileType($id, $required, $optional); if ($type) { $profiles[$id] = $title; } } return $profiles; }