'greeting_type' => $greeting,
];
- //add addressee in Contact form
+ // Add addressee in Contact form.
$greetingTokens = CRM_Core_PseudoConstant::greeting($filter);
+
+ // Instead of showing smarty token with/o conditional logic in Drop down
+ // list, show processed token (Only in Contact Edit mode).
+ // Get Description of each greeting.
+ $greetingTokensDescription = CRM_Core_PseudoConstant::greeting($filter, 'description');
+ if ($form->_contactId) {
+ $renderedGreetingTokens = CRM_Core_TokenSmarty::render($greetingTokens,
+ [
+ 'contactId' => $form->_contactId,
+ ]
+ );
+ foreach ($greetingTokens as $key => &$emailGreetingString) {
+ if ($emailGreetingString) {
+ $emailGreetingString = $renderedGreetingTokens[$key];
+ $emailGreetingString = CRM_Core_DAO::escapeString(CRM_Utils_String::stripSpaces($emailGreetingString));
+ if (!empty($greetingTokensDescription[$key])) {
+ // Append description to processed greeting.
+ $emailGreetingString .= ' ( ' . $greetingTokensDescription[$key] . ' )';
+ }
+ }
+ }
+ }
if (!empty($greetingTokens)) {
$form->addElement('select', $fields['field'], $fields['label'],
[
<td>{$form.description.html}<br />
{if $gName eq 'activity_type'}
<span class="description">{ts}Description is included at the top of the activity edit and view pages for this type of activity.{/ts}</span>
+ {elseif $gName eq 'email_greeting' || $gName eq 'postal_greeting' || $gName eq 'addressee'}
+ <span class="description">{ts}Description will be appended to processed greeting.{/ts}</span>
+ {/if}
</td>
</tr>
- {/if}
{/if}
{if $gName eq 'participant_status'}
<tr class="crm-admin-options-form-block-visibility_id">