function elysia_cron_ctools_export_callback in Elysia Cron 7.2
Same name and namespace in other branches
- 6.2 elysia_cron.ctools.inc \elysia_cron_ctools_export_callback()
- 6 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).
Parameters
object $object:
string $indent:
Return value
string
1 string reference to 'elysia_cron_ctools_export_callback'
- elysia_cron_schema in ./
elysia_cron.install - Implements hook_schema().
File
- ./
elysia_cron.ctools.inc, line 203 - Ctools integration.
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) . '();' . ELYSIA_CRON_CTOOLS_LINEBREAK;
if ($schema['export']['can disable']) {
$output .= $indent . '$' . $identifier . '->disabled = FALSE; /* Edit this to true to make a default ' . $identifier . ' disabled initially */' . ELYSIA_CRON_CTOOLS_LINEBREAK;
}
if (!empty($schema['export']['api']['current_version'])) {
$output .= $indent . '$' . $identifier . '->api_version = ' . $schema['export']['api']['current_version'] . ';' . ELYSIA_CRON_CTOOLS_LINEBREAK;
}
$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) . ';' . ELYSIA_CRON_CTOOLS_LINEBREAK;
}
return $output;
}