Add a Custom Button to Invoices

I need to place a button on the invoice detail page that will open a link created with the invoice ID. I have seen How to add a button to Detailview -- Actions Tab - #2 by BrozTechnologies and tried to implement:

/…/custom/modules/AOS_Invoices/metadata/detailviewdefs.php:

    array(
      'buttons' =>
      array(
        0 => 'EDIT',
        1 => 'DUPLICATE',
        2 => 'DELETE',
        3 => 'FIND_DUPLICATES',
        4 =>
        array(
          'customCode' => '<input type="button" class="button" onClick="showPopup(\'pdf\');" value="{$MOD.LBL_PRINT_AS_PDF}">',
        ),
        5 =>
        array(
          'customCode' => '<input type="button" class="button" onClick="showPopup(\'emailpdf\');" value="{$MOD.LBL_EMAIL_PDF}">',
        ),
        6 =>
        array(
          'customCode' => '<input type="button" class="button" onClick="showPopup(\'email\');" value="{$MOD.LBL_EMAIL_INVOICE}">',
        ),
        7 =>
        array(
        'customCode' => '{$export_csv}',
       ),
     ),
   ),

/…/custom/modules/AOS_Invoices/views/view.detail.php:

 public function populateInvoiceTemplates()
 {
     global $app_list_strings;

     $sql = "SELECT id, name FROM aos_pdf_templates WHERE deleted = 0 AND type='AOS_Invoices' AND active = 1";

     $this->dv->ss->assign('export_csv', '<input type="button" onclick="javascript: location.href=\'http://localhost:8888/get_invoice/222" value="export CSV"/>');
     $res = $this->bean->db->query($sql);
     $app_list_strings['template_ddown_c_list'] = array();
     while ($row = $this->bean->db->fetchByAssoc($res)) {
         $app_list_strings['template_ddown_c_list'][$row['id']] = $row['name'];
     }
 }

I’ve tried placing the new button code in both the populateInvoiceTemplate and in display methods of view.detail.php, but neither one results in a new button in the interface. I have done a quick repair/rebuild and page refresh after each code change.

I’m using SuiteCRM Version 7.12.1 and php version 8.1.3

What do I need to do to make the button show up?
And what do I need to do to get the current invoice number? (In this testing code I have it using a static invoice number)

After upgrading to version 7.12.5, with no changes to the above code, the button is now appearing in the interface. Now I just need to figure out how to connect it to the API that will export the invoices.