From: eileen Date: Fri, 2 Feb 2024 05:04:47 +0000 (+1300) Subject: Fix wonkyness if contribution page includes a profile with both groups & tags X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a04a1bfdb0e3222dcf029b318b17a0349bd49991;p=civicrm-core.git Fix wonkyness if contribution page includes a profile with both groups & tags --- diff --git a/CRM/Contact/Form/Edit/TagsAndGroups.php b/CRM/Contact/Form/Edit/TagsAndGroups.php index 4beab414fd..1ea0955697 100644 --- a/CRM/Contact/Form/Edit/TagsAndGroups.php +++ b/CRM/Contact/Form/Edit/TagsAndGroups.php @@ -58,7 +58,6 @@ class CRM_Contact_Form_Edit_TagsAndGroups { $groupElementType = 'checkbox', $public = FALSE ) { - $tagGroup = []; $form->addExpectedSmartyVariable('type'); $form->addOptionalQuickFormElement('group'); // NYSS 5670 @@ -131,6 +130,7 @@ class CRM_Contact_Form_Edit_TagsAndGroups { $form->assign('groupElementType', $groupElementType ?? NULL); if ($type & self::TAG) { + $tagGroup = []; $tags = CRM_Core_BAO_Tag::getColorTags('civicrm_contact'); if (!empty($tags)) { @@ -141,7 +141,7 @@ class CRM_Contact_Form_Edit_TagsAndGroups { $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact'); CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_contact', $contactId, FALSE, TRUE); } - $form->assign('tagGroup', $tagGroup); + $form->assign('tagGroup', $tagGroup ?? NULL); } /** diff --git a/templates/CRM/UF/Form/Fields.tpl b/templates/CRM/UF/Form/Fields.tpl index b1dd3af32e..f697dc71ae 100644 --- a/templates/CRM/UF/Form/Fields.tpl +++ b/templates/CRM/UF/Form/Fields.tpl @@ -65,8 +65,39 @@ {if $profileFieldName eq 'email_greeting' or $profileFieldName eq 'postal_greeting' or $profileFieldName eq 'addressee'} {include file="CRM/Profile/Form/GreetingType.tpl"} + {elseif $profileFieldName eq 'tag'} + + + + +
+
+ {if !empty($title)}{$form.tag.label}
{/if} + {$form.tag.html} +
+
{elseif ($profileFieldName eq 'group' && $form.group) || ($profileFieldName eq 'tag' && $form.tag)} - {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$profileFieldName title=null context="profile"} + + + + +
+ {if $groupElementType eq 'select'} +
+ {if $title}{$form.group.label}
{/if} + {$form.group.html} +
+ {else} + {foreach key=key item=item from=$tagGroup.group} +
+ {$form.group.$key.html} + {if $item.description} +
{$item.description}
+ {/if} +
+ {/foreach} + {/if} +
{elseif array_key_exists('is_datetime_field', $field) && $field.is_datetime_field && $action & 4} {$formElement.value|crmDate:$field.smarty_view_format}