[#18] implementing xcm profiles
This commit is contained in:
parent
8ae3f658c0
commit
8642ab5cfd
6 changed files with 77 additions and 6 deletions
|
@ -98,6 +98,14 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
*/
|
||||
protected static $_locationTypes = NULL;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
* A static cache of retrieved location types found within
|
||||
* static::getXCMProfiles().
|
||||
*/
|
||||
protected static $_xcm_profiles = NULL;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
|
@ -198,6 +206,14 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
TRUE // is required
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'select',
|
||||
'xcm_profile',
|
||||
E::ts('Contact Matcher (XCM) Profile'),
|
||||
static::getXCMProfiles(),
|
||||
TRUE
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'select',
|
||||
'location_type_id',
|
||||
|
@ -510,6 +526,26 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
return static::$_locationTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves XCM profiles (if supported). 'default' profile is always available
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getXCMProfiles() {
|
||||
if (!isset(static::$_xcm_profiles)) {
|
||||
static::$_xcm_profiles = array(
|
||||
'' => E::ts("<default profile>"),
|
||||
);
|
||||
if (method_exists('CRM_Xcm_Configuration', 'getProfileList')) {
|
||||
$profiles = CRM_Xcm_Configuration::getProfileList();
|
||||
foreach ($profiles as $profile_key => $profile_name) {
|
||||
static::$_xcm_profiles[$profile_key] = $profile_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return static::$_xcm_profiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves financial types present within the system as options for select
|
||||
* form elements.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue