You are here

function form_builder_cache_load in Form Builder 6

Same name and namespace in other branches
  1. 7 includes/form_builder.cache.inc \form_builder_cache_load()

Load a form configuration cache.

Parameters

$form_type: The type of form being edited.

$form_id: The unique identifier for the form type.

Return value

A FAPI array if a cache entry was found. Boolean FALSE if an entry does not yet exist. Note that an empty FAPI array may exist, so be sure to use strict comparison (===) when checking return values.

13 calls to form_builder_cache_load()
form_builder_cache_difference in includes/form_builder.cache.inc
Compare the cached form with the original and return all changed elements.
form_builder_cache_field_delete in includes/form_builder.cache.inc
Remove a single field from a form builder cache.
form_builder_cache_field_load in includes/form_builder.cache.inc
Retrieve a single field from a form cache..
form_builder_cache_field_save in includes/form_builder.cache.inc
Add or update a single field in a form builder cache.
form_builder_cache_save in includes/form_builder.cache.inc
Save a form builder cache based on the form structure.

... See full list

File

includes/form_builder.cache.inc, line 20
form_builder.cache.inc Functions for temporary storage of form builder structures while editing.

Code

function form_builder_cache_load($form_type, $form_id, $sid = NULL, $reset = FALSE) {
  static $data;
  $sid = isset($sid) ? $sid : session_id();
  if ($reset) {
    $data = NULL;
  }
  if (empty($data) && !empty($form_type) && !empty($form_id)) {
    $data = db_result(db_query("SELECT data FROM {form_builder_cache} WHERE type = '%s' AND form_id = '%s' AND sid = '%s'", $form_type, $form_id, $sid));
    if ($data) {
      $data = unserialize($data);
    }
  }
  return $data;
}