Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 419 to 446

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 19th March 2024 05:05 Europe/London time based on the source file dated 8th March 2024 15:10 Europe/London time.