Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

get_pdf_templates()

Description

Returns an array of available PDF template names

Parameters

ColumnTypeDefaultDescription
$template_namespace string The name by which multiple templates are grouped together e.g. contact_sheet

Return

array()

Location

include/pdf_functions.php lines 414 to 441

Definition

 
function get_pdf_templates($template_namespace)
    {
    global 
$storagedir;

    
$templates = array();
    
$remove_directory_listings = array('.''..');

    
// Directories that may contain these files
    
$default_tpl_dir   dirname(__FILE__) . "/../templates/{$template_namespace}";
    
$filestore_tpl_dir "{$storagedir}/system/templates/{$template_namespace}";

    if(!
file_exists($default_tpl_dir))
        {
        
trigger_error("ResourceSpace could not find templates folder '{$template_namespace}'");
        }

    
// Get default path
    
$templates array_diff(scandir($default_tpl_dir), $remove_directory_listings);

    
// Get custom template (if any)
    
if(file_exists($filestore_tpl_dir))
        {
        
$filestore_templates array_diff(scandir($filestore_tpl_dir), $remove_directory_listings);
        
$templates array_merge($templates,$filestore_templates);
        }
    
$templates array_map(function($e){return pathinfo($ePATHINFO_FILENAME);}, $templates);
    return 
$templates;
    }

This article was last updated 15th July 2020 01:35 Europe/London time based on the source file dated 17th June 2020 11:52 Europe/London time.