You are here

function ctools_component_features_export_render in Features 7

Same name and namespace in other branches
  1. 6 includes/features.ctools.inc \ctools_component_features_export_render()
  2. 7.2 includes/features.ctools.inc \ctools_component_features_export_render()

Master implementation of hook_features_export_render() for all ctools components.

1 call to ctools_component_features_export_render()
page_manager_pages_features_export_render in includes/features.ctools.inc
Implements hook_features_export_render() for page_manager.

File

includes/features.ctools.inc, line 182

Code

function ctools_component_features_export_render($component, $module, $data) {

  // Reset the export display static to prevent clashes.
  drupal_static_reset('panels_export_display');
  ctools_include('export');
  $schema = ctools_export_get_schema($component);
  if (function_exists($schema['export']['to hook code callback'])) {
    $export = $schema['export']['to hook code callback']($data, $module);
    $code = explode("{\n", $export);
    array_shift($code);
    $code = explode('}', implode($code, "{\n"));
    array_pop($code);
    $code = implode('}', $code);
  }
  else {
    $code = '  $export = array();' . "\n\n";
    foreach ($data as $object_name) {
      if ($object = _ctools_features_export_crud_load($component, $object_name)) {
        $identifier = $schema['export']['identifier'];
        $code .= _ctools_features_export_crud_export($component, $object, '  ');
        $code .= "  \$export[" . ctools_var_export($object_name) . "] = \${$identifier};\n\n";
      }
    }
    $code .= '  return $export;';
  }
  return array(
    $schema['export']['default hook'] => $code,
  );
}