function fe_block_boxes_features_export_render in Features Extra 6
Same name and namespace in other branches
- 7 fe_block/fe_block.module \fe_block_boxes_features_export_render()
Implementation of hook_features_export_render().
File
- ./
fe_block.module, line 223
Code
function fe_block_boxes_features_export_render($module_name = '', $data) {
ctools_include('export');
$component = 'fe_block_boxes';
$schema = ctools_export_get_schema($component);
$objects = ctools_export_load_object($component);
$code = array();
$code[] = ' $export = array();';
$code[] = '';
foreach ($data as $machine_name) {
// The object to be exported.
if ($object = $objects[$machine_name]) {
$additions = array();
// Load box.
if (!empty($object->bid)) {
$box = block_box_get($object->bid);
if ($box) {
$additions = (array) $box;
}
unset($additions['bid'], $additions['body']);
}
// Code.
$identifier = $schema['export']['identifier'];
$code[] = ctools_export_object($component, $object, ' ', $identifier, $additions) . ' $' . $identifier . '->body = ' . features_var_export($box['body']) . ';';
$code[] = '';
$code[] = ' $export[\'' . $machine_name . '\'] = $' . $identifier . ';';
$code[] = '';
}
}
$code[] = ' return $export;';
$code = implode("\n", $code);
return array(
$schema['export']['default hook'] => $code,
);
}