Recently I needed to modify Smarty variables being passed into a template from an extension. I tried a couple of likely hooks, but neither of them seemed to provide this functionality. The templates in question were Confirm.tpl from various locations.
Is there hook functionality (akin to Drupal's preprocess functions) which permits adjusting variables in templates?
Background: for the eWay Recurring payment processor when using clientside encryption (Github branch), the CC value is submitted as a long encrypted string. CiviCRM renders this as a thousand stars on the confirm template; I wanted to render this nineteen stars rather than a thousand stars followed by the last four digits of the encrypted string.
I was able to achieve this with template overrides in the extension (PR #11), but it doesn't feel like the best approach to do this - much chance of conflict with other customisations / extensions / CiviCRM changes being my concern.
hook_civicrm_alterContent
could be used to modify the output in this case (replace long strings of*
s with a short string) ... this is probably as bad as the template route though, just differently bad :)