Smarty 3+ compatibility fix
This code fails in Smarty 3+. See https://github.com/civicrm/civicrm-core/pull/27589 for an example of this change in core.
Once Smarty 2 is dropped, we can change these again to getTemplateVars() but for now we use get_template_vars() and rely on the Civi Smarty compatibility layer.