[REF] Complete decommissioning on CRM/Contribute/Form/Task/PDFLetterCommon.php
authoreileen <emcnaughton@wikimedia.org>
Tue, 27 Apr 2021 23:23:29 +0000 (11:23 +1200)
committereileen <emcnaughton@wikimedia.org>
Wed, 28 Apr 2021 01:07:24 +0000 (13:07 +1200)
commit12d8880731a3b57eff850396bab406538657254c
tree652a38a84b0f5cd22adb93fb8e8ccddad629fb2d
parent6e53da398d4be165b70125b5e1da1925620f3089
[REF] Complete decommissioning on CRM/Contribute/Form/Task/PDFLetterCommon.php

This removes the last function fromCRM/Contribute/Form/Task/PDFLetterCommon.php

The function was calling a protected function on the parent which had to be unravelled.

I used the method we used in
https://github.com/civicrm/civicrm-core/blob/5e67eb7ff3f1f202d5112d15ad5c6a5f23f35795/CRM/SMS/Form/Upload.php#L341
to replace the code with the part that we have tested as being done in via render - ie replacing
hook, contact, domain tokens & smarty parsing.

However, there are quite a few tests on this code & one checked that we don't over-call
the token hook. I added some caching for the results of this hook so we can start to
eliminate these but I also allowed the calls to increment by 1 because it is not 1 per row

I made the results of this hook optional to replaceHookTokens & in general I think that
is the only place it needs to be called - perhaps once it used to pass more parameters &
the results were dynamic but now they really aren't
CRM/Contribute/Form/Task/PDFLetter.php
CRM/Contribute/Form/Task/PDFLetterCommon.php [deleted file]
CRM/Utils/Token.php
Civi/Token/TokenCompatSubscriber.php
tests/phpunit/CRM/Contribute/Form/Task/PDFLetterCommonTest.php