function _fillpdf_old_file_context_load in FillPDF 7
Load a context object.
Parameters
int $fcid: The fcid of the context object to load.
Return value
object|bool Returns the decoded context object or FALSE if the fcid cannot be found.
1 call to _fillpdf_old_file_context_load()
- fillpdf_update_7106 in ./
fillpdf.install - Convert old JSON file contexts to the link-based format.
File
- ./
fillpdf.install, line 363 - Install.
Code
function _fillpdf_old_file_context_load($fcid) {
$json = db_query('SELECT context
FROM {fillpdf_file_context}
WHERE fcid = :fcid', array(
':fcid' => $fcid,
))
->fetchField();
// There might be new data in the DB already, so make sure this looks JSON-y.
if ($json && substr($json, 0, 1) === '{') {
$json = json_decode($json);
// Fix the structure of the array; json_decode isn't 100% smart.
$json = (array) $json;
$json_copy = $json;
foreach ((array) $json_copy['webforms'] as $index => $webform) {
$json['webforms'][$index] = (array) $json_copy['webforms'][$index];
}
}
else {
$json = FALSE;
}
return $json;
}