Afform - display privacy flag icons
Overview
Form builder allows an icon to be selected conditionally when displaying a field. However, the icons that we use for the privacy flags 'do not email', 'do not phone' etc are actually multiple stacked icons and cannot be added to the display.
Example use-case
It would be useful (probably recommended) that when displaying an email address (or phone etc) for a contact with the 'do not email' privacy flag that the icon is shown next to the email address.
Current behaviour
A single icon can be displayed, but not stacked icons.
Proposed behaviour
Be able to display the privacy flag icons.
Comments
The privacy icons are added by the smarty function CRM/Core/Smarty/plugins/function.privacyFlag.php
Form builder allows using smarty in the rewrite field so I tried a rewrite of:
{privacyFlag field=do_not_email condition=[do_not_email]}
but 2 problems:
- the generated html is displayed rather than the icons
- conditional does not work because the
[do_not_email]
is passed as 'Yes' or 'No' instead of 1 or 0.
One approach would be to refactor the stacked icons out of the smarty function and make privacy flag icons a specific option in form builder.
Alternatively the form builder support for icons could be expanded to allow arbitrary stacked icons.