use the id instead of the name to look up profiles

This commit is contained in:
Marc Michalsky 2023-08-03 15:06:27 +02:00 committed by Jens Schuppe
parent 1d9e973e46
commit d9e51c67f6
4 changed files with 157 additions and 77 deletions

View file

@ -22,10 +22,11 @@ class CRM_Twingle_Page_Profiles extends CRM_Core_Page {
public function run() {
CRM_Utils_System::setTitle(E::ts('Twingle API Profiles'));
$profiles = [];
foreach (CRM_Twingle_Profile::getProfiles() as $profile_name => $profile) {
$profiles[$profile_name]['name'] = $profile_name;
foreach (CRM_Twingle_Profile::getProfiles() as $profile_id => $profile) {
$profiles[$profile_id]['id'] = $profile_id;
$profiles[$profile_id]['name'] = $profile->getName();
foreach (CRM_Twingle_Profile::allowedAttributes() as $attribute) {
$profiles[$profile_name][$attribute] = $profile->getAttribute($attribute);
$profiles[$profile_id][$attribute] = $profile->getAttribute($attribute);
}
}
$this->assign('profiles', $profiles);