CRM-17658 PDFs: add new region 'pdf-header' in head of PDFs
authorAndrew Hunt <andrew@aghstrategies.com>
Thu, 3 Dec 2015 17:29:00 +0000 (12:29 -0500)
committerAndrew Hunt <andrew@aghstrategies.com>
Thu, 3 Dec 2015 19:42:54 +0000 (14:42 -0500)
CRM/Utils/PDF/Utils.php

index 9f103d72a8ca1857fcf02e48ed146981d2cedfeb..0ae94ed5ffd07e26770a3e5b00c8d5daf9eef22f 100644 (file)
@@ -84,12 +84,18 @@ class CRM_Utils_PDF_Utils {
     $margins = array($metric, $t, $r, $b, $l);
 
     $config = CRM_Core_Config::singleton();
+
+    // Add a special region for the HTML header of PDF files:
+    $pdfHeaderRegion = CRM_Core_Region::instance('pdf-header', FALSE);
+    $htmlHeader = ($pdfHeaderRegion) ? $pdfHeaderRegion->render('', FALSE) : '';
+
     $html = "
 <html>
   <head>
     <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
     <style>@page { margin: {$t}{$metric} {$r}{$metric} {$b}{$metric} {$l}{$metric}; }</style>
     <style type=\"text/css\">@import url({$config->userFrameworkResourceURL}css/print.css);</style>
+    {$htmlHeader}
   </head>
   <body>
     <div id=\"crm-container\">\n";