You are here

function fillpdf_load in FillPDF 7

Same name and namespace in other branches
  1. 7.2 fillpdf.module \fillpdf_load()

Loads a FillPDF template by ID.

Parameters

int $fid: The {fillpdf_forms.fid} of the template.

bool $reset: When TRUE, ignore the static cache for this record.

bool $process_replacements: When TRUE, transformations will be turned into an array. Otherwise, they will be left in text format (for example, to use as a default value for form fields).

Return value

object|false The loaded object with properties corresponding to the database fields or FALSE if it could not be found.

11 calls to fillpdf_load()
FillPdfMergeTestCase::backendTest in tests/FillPdfMergeTestCase.test
Tests PDF merging.
FillPdfMergeTestCase::testPdfMerging in tests/FillPdfMergeTestCase.test
Test PDF merging.
fillpdf_field in ./fillpdf.admin.inc
Retrieve a field from a PDF for use in editing form.
fillpdf_file_download in ./fillpdf.module
Implements hook_file_download().
fillpdf_form_delete_confirm in ./fillpdf.admin.inc
Delete form confirmation.

... See full list

File

./fillpdf.module, line 2037

Code

function fillpdf_load($fid, $reset = FALSE, $process_replacements = TRUE) {

  // Cache query results.
  static $fillpdf = array();
  if (!isset($fillpdf[$fid]) || $reset) {
    $fillpdf[$fid] = db_query("SELECT * FROM {fillpdf_forms} WHERE fid = :fid", array(
      ':fid' => $fid,
    ))
      ->fetch();
  }
  if ($fillpdf[$fid]) {
    $this_fillpdf = clone $fillpdf[$fid];
    if ($process_replacements) {

      // Turn replacements (textarea content) into an array.
      $this_fillpdf->replacements = _fillpdf_replacements_to_array($this_fillpdf->replacements);
    }
    return $this_fillpdf;
  }
  return FALSE;
}