Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

get_pdf_template_path()

Parameters

ColumnTypeDefaultDescription
$resource_type
$template_name ''

Location

include/pdf_functions.php lines 10 to 54

Definition

 
function get_pdf_template_path($resource_type$template_name '')
    {
    global 
$storagedir$pdf_resource_type_templates;

    
$template      '';

    if(!
array_key_exists($resource_type$pdf_resource_type_templates))
        {
        
debug('There are no PDF templates set for resource type "' $resource_type '"');
        return 
false;
        }
    
    
$templates     $pdf_resource_type_templates[$resource_type];

    if(
array_key_exists($resource_type$pdf_resource_type_templates) && empty($templates))
        {
        
debug('There are no PDF templates set for resource type "' $resource_type '"');
        return 
false;
        }

    
// Client code wants a specific template name but there isn't one
    
if('' !== $template_name && !in_array($template_name$templates))
        {
        
debug('PDF template "' $template_name '" could not be found in $pdf_resource_type_templates');
        return 
false;
        }

    
// Client code wants a specific template name
    
if('' !== $template_name && in_array($template_name$templates))
        {
        
$template_array_key array_search($template_name$templates);
        if(
false !== $template_array_key)
            {
            
$template $templates[$template_array_key];
            }
        }

    
// Provide a default one if template name is empty
    
if('' === $template && '' === $template_name)
        {
        
$template $templates[0];
        }

    return 
$storagedir '/system/pdf_templates/' $template '.html';
    }

This article was last updated 19th March 2024 06:35 Europe/London time based on the source file dated 8th March 2024 15:10 Europe/London time.