You are here

function uc_invoice_template_list in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_order/uc_order.module \uc_invoice_template_list()
  2. 7.3 uc_order/uc_order.module \uc_invoice_template_list()

Return array of invoice template files found in ubercart/uc_order/templates.

1 call to uc_invoice_template_list()
uc_order_template_options in uc_order/uc_order.module

File

uc_order/uc_order.module, line 2961

Code

function uc_invoice_template_list() {
  static $templates = array();

  // If the template list hasn't already been loaded...
  if (empty($templates)) {
    $dir = drupal_get_path('module', 'uc_order') . '/templates/';

    // Loop through all the files found in the directory.
    foreach (file_scan_directory($dir, '.*\\.itpl\\.php', array(
      '.',
      '..',
      'CVS',
    ), 0, FALSE) as $file) {

      // Add them by name to the templates array, trimming off the extension.
      $templates[] = substr($file->name, 0, strlen($file->name) - 5);
    }
    sort($templates);
  }
  return $templates;
}