function ctools_export_to_hook_code

Convert a group of objects to code based upon input and return this as a larger export.

1 call to ctools_export_to_hook_code()
bulk_export_export_form_submit in bulk_export/bulk_export.module
Process the bulk export submit form and make the results available.

File

includes/export.inc, line 1189

Code

function ctools_export_to_hook_code(&$code, $table, $names = array(), $name = 'foo') {
    $schema = ctools_export_get_schema($table);
    $export = $schema['export'];
    // Use the schema-specified function for generating hook code, if one exists.
    if (function_exists($export['to hook code callback'])) {
        $output = $export['to hook code callback']($names, $name);
    }
    else {
        $output = ctools_export_default_to_hook_code($schema, $table, $names, $name);
    }
    if (!empty($output)) {
        if (isset($export['api'])) {
            if (isset($code[$export['api']['owner']][$export['api']['api']]['version'])) {
                $code[$export['api']['owner']][$export['api']['api']]['version'] = max($code[$export['api']['owner']][$export['api']['api']]['version'], $export['api']['minimum_version']);
            }
            else {
                $code[$export['api']['owner']][$export['api']['api']]['version'] = $export['api']['minimum_version'];
                $code[$export['api']['owner']][$export['api']['api']]['code'] = '';
            }
            $code[$export['api']['owner']][$export['api']['api']]['code'] .= $output;
        }
        else {
            if (empty($code['general'])) {
                $code['general'] = '';
            }
            $code['general'] .= $output;
        }
    }
}