Answers.Body: <p>If you look a <a href="https://lab.civicrm.org/extensions/cdntaxreceipts/-/blob/master/cdntaxreceipts.functions.inc#L321" rel="nofollow noreferrer">few lines down</a> from there it calls hook_cdntaxreceipts_writeReceipt where you can do something custom. There is also hook_cdntaxreceipts_alter_receipt as described in the readme.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-18T14:00:07.897Z
Answers.Text: Thank you Demerit! Unlike this function declaration: https://lab.civicrm.org/extensions/cdntaxreceipts/-/blob/master/cdntaxreceipts.functions.inc#L349 it is indeed possible to get $receipt as an argument of the _cdntaxreceipts_writeReceipt() function.
Answers.UserDisplayName: Pierre
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-18T12:55:15.747Z
Answers.LastActivityDate: 2024-03-18T12:55:15.747Z
Answers.UserDisplayName: Demerit
Body: <p><a href="https://lab.civicrm.org/extensions/cdntaxreceipts" rel="nofollow noreferrer">CDNTaxReceipts</a> is a Tax Receipts extension for CiviCRM.
  This extension is a way to generate pdf including recipient's personal data. Those Data are listed in an array <code>$pdf_variables</code> declared in <a href="https://lab.civicrm.org/extensions/cdntaxreceipts/-/blob/master/cdntaxreceipts.functions.inc#L261" rel="nofollow noreferrer"><code>cdntaxreceipts_generateFormattedReceipt()</code></a>.</p>
  <p>Is there any proper way to extend <code>$pdf_variables[]</code> ? I would like to add a <code>custom_field</code> entry.</p>
  
Tags: <extension><hooks><cdn-tax-receipts>
Title: CDNTaxReceipts extend $pdf_variables[]
ThreadText: # CDNTaxReceipts extend $pdf_variables[]
  
  (Asked by: username_0 on 2024-03-18)
  
  [CDNTaxReceipts](https://lab.civicrm.org/extensions/cdntaxreceipts) is a Tax Receipts extension for CiviCRM.
  This extension is a way to generate pdf including recipient's personal data. Those Data are listed in an array `$pdf_variables` declared in [`cdntaxreceipts_generateFormattedReceipt()`](https://lab.civicrm.org/extensions/cdntaxreceipts/-/blob/master/cdntaxreceipts.functions.inc#L261).
  
  Is there any proper way to extend `$pdf_variables[]` ? I would like to add a `custom_field` entry.
  
  **Tags:** extension, hooks, cdn-tax-receipts
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-03-18. Score: 1 | Accepted answer
  
  If you look a [few lines down](https://lab.civicrm.org/extensions/cdntaxreceipts/-/blob/master/cdntaxreceipts.functions.inc#L321) from there it calls hook\_cdntaxreceipts\_writeReceipt where you can do something custom. There is also hook\_cdntaxreceipts\_alter\_receipt as described in the readme.
  
  > **Comments:**
  > **username_0**: Thank you username_1! Unlike this function declaration: https://lab.civicrm.org/extensions/cdntaxreceipts/-/blob/master/cdntaxreceipts.functions.inc#L349 it is indeed possible to get $receipt as an argument of the _cdntaxreceipts_writeReceipt() function.  
  
  ---
  
  