You are here

function homebox_features_export_render in Homebox 6.2

Same name and namespace in other branches
  1. 6.3 homebox.features.inc \homebox_features_export_render()
  2. 7.3 homebox.features.inc \homebox_features_export_render()
  3. 7.2 homebox.features.inc \homebox_features_export_render()

Implementation of hook_features_export_render().

File

./homebox.features.inc, line 55
Features support.

Code

function homebox_features_export_render($module = 'foo', $data) {
  $code = array();

  // Begin code
  $code[] = '  $homeboxes = array();' . "\n";
  foreach ($data as $name) {

    // Load the page
    $page = homebox_get_page($name);

    // Create exported settings
    $export = var_export($page->settings, 1);

    // Fix spacing
    $export = str_replace("\n", "\n  ", $export);

    // Add to code
    $code[] = '  $homeboxes[\'' . $page->name . '\'] = ' . $export . ";\n";
  }

  // End code
  $code[] = "\n" . '  return $homeboxes;';

  // Put code into a string
  $code = implode($code, "\n");
  return array(
    'homebox' => $code,
  );
}