function elysia_cron_ctools_to_hook_code in Elysia Cron 6.2
Same name and namespace in other branches
- 6 elysia_cron.ctools.inc \elysia_cron_ctools_to_hook_code()
- 7.2 elysia_cron.ctools.inc \elysia_cron_ctools_to_hook_code()
- 7 elysia_cron.ctools.inc \elysia_cron_ctools_to_hook_code()
Ctools export to hook code callback Original "to hook code" callback doesn't support the replacement of "load/load all" callback (it simply ignores them, even if defined and supported elsewhere) This code is equal to the original ctools one, but uses specific load callback
1 string reference to 'elysia_cron_ctools_to_hook_code'
File
- ./
elysia_cron.ctools.inc, line 181
Code
function elysia_cron_ctools_to_hook_code($names, $name) {
$table = 'elysia_cron';
$schema = ctools_export_get_schema($table);
$export = $schema['export'];
$output = '';
$objects = elysia_cron_ctools_export_load_all();
$objects = array_intersect_key($objects, array_flip($names));
if ($objects) {
$output = "/**\n";
$output .= " * Implementation of hook_{$export['default hook']}()\n";
$output .= " */\n";
$output .= "function " . $name . "_{$export['default hook']}() {\n";
$output .= " \${$export['identifier']}s = array();\n\n";
foreach ($objects as $object) {
$output .= ctools_export_crud_export($table, $object, ' ');
$output .= " \${$export['identifier']}s['" . check_plain($object->{$export}['key']) . "'] = \${$export['identifier']};\n\n";
}
$output .= " return \${$export['identifier']}s;\n";
$output .= "}\n";
}
return $output;
}