function context_features_export_render in Features 6
Implementation of hook_features_export_render().
File
- includes/
features.context.inc, line 159
Code
function context_features_export_render($module, $data) {
// 3.x
if (context_features_get_version() === 3) {
return ctools_component_features_export_render('context', $module, $data);
}
// 2.x
$code = array();
$code[] = ' $items = array();';
$code[] = '';
foreach ($data as $identifier) {
$contexts = context_enabled_contexts();
$context = $contexts[$identifier];
// prune system specific information and cast for Drupal's AOP (array oriented programming)
$prune = array(
'cid',
'status',
'system',
'type',
);
foreach ($prune as $key) {
if (isset($context->{$key})) {
unset($context->{$key});
}
}
$context = (array) $context;
// clean up blocks
if (!empty($context['block'])) {
foreach ($context['block'] as $bid => $block) {
unset($block->bid);
$context['block'][$bid] = (array) $block;
}
}
$context_identifier = context_var_export($identifier);
$context_export = context_var_export($context, ' ');
$code[] = " \$items[{$context_identifier}] = {$context_export};";
}
$code[] = ' return $items;';
$code = implode("\n", $code);
return array(
'context_default_contexts' => $code,
);
}