function elysia_cron_ctools_export_callback in Elysia Cron 6.2
Same name and namespace in other branches
- 6 elysia_cron.ctools.inc \elysia_cron_ctools_export_callback()
- 7.2 elysia_cron.ctools.inc \elysia_cron_ctools_export_callback()
- 7 elysia_cron.ctools.inc \elysia_cron_ctools_export_callback()
Ctools export callback Handles NULL value (it's not possible to do this with "field" export callback, because null values are rewritten before its call)
1 string reference to 'elysia_cron_ctools_export_callback'
File
- ./
elysia_cron.ctools.inc, line 146
Code
function elysia_cron_ctools_export_callback($object, $indent) {
$table = 'elysia_cron';
$schema = ctools_export_get_schema($table);
$identifier = $schema['export']['identifier'];
$output = $indent . '$' . $identifier . ' = new ' . get_class($object) . ";\n";
if ($schema['export']['can disable']) {
$output .= $indent . '$' . $identifier . '->disabled = FALSE; /* Edit this to true to make a default ' . $identifier . ' disabled initially */' . "\n";
}
if (!empty($schema['export']['api']['current_version'])) {
$output .= $indent . '$' . $identifier . '->api_version = ' . $schema['export']['api']['current_version'] . ";\n";
}
$fields = $schema['fields'];
foreach ($fields as $field => $info) {
if (!empty($info['no export'])) {
continue;
}
$value = isset($object->{$field}) ? $object->{$field} : (isset($info['default']) ? $info['default'] : NULL);
if (!is_null($value) && $info['type'] == 'int') {
$value = isset($info['size']) && $info['size'] == 'tiny' ? (bool) $value : (int) $value;
}
$output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n";
}
return $output;
}