You are here

public static function ViewsPdfBase::getTemplatePath in Views PDF 8

This method returns the path to a specific template.

File

src/ViewsPdfBase.php, line 1077
Contains \Drupal\views_pdf\ViewsPdfTemplate.

Class

ViewsPdfBase
The main class to generate the PDF.

Namespace

Drupal\views_pdf

Code

public static function getTemplatePath($template, $row = NULL, $view = NULL) {
  if (empty($template)) {
    return '';
  }
  if ($row != NULL && $view != NULL && !preg_match('/\\.pdf/', $template)) {
    return drupal_realpath($row->field_data_field_file_node_values[0]['uri']);
  }
  $template_dir = variable_get('views_pdf_template_stream', 'public://views_pdf_templates');
  return drupal_realpath($template_dir . '/' . $template);
}