You are here

public static function PdfTemplate::getTemplatePath in Views PDF 6

Same name and namespace in other branches
  1. 7.3 views_pdf_template.php \PdfTemplate::getTemplatePath()
  2. 7 views_pdf_template.php \PdfTemplate::getTemplatePath()
  3. 7.2 views_pdf_template.php \PdfTemplate::getTemplatePath()

This method returns the path to a specific template.

File

./views_pdf_template.php, line 848
PDF Class to generate PDFs with native PHP. This class based on FPDF and FPDI.

Class

PdfTemplate
The main class to generate the PDF.

Code

public static function getTemplatePath($template, $row = null, $view = null) {
  if (empty($template)) {
    return '';
  }
  if ($row != null && $view != null && !preg_match('/\\.pdf/', $template) && isset($view->field[$template])) {
    return $view->field[$template]
      ->theme($row);
  }
  $files_path = file_directory_path();
  $template_dir = variable_get('views_pdf_template_path', 'views_pdf_templates');
  $dir = $files_path . '/' . $template_dir;
  return $dir . '/' . $template . '.pdf';
}