You are here

function spaces_features_export_render in Spaces 6.2

Implementation of hook_spaces_features_export_render().

File

./spaces.features.inc, line 19

Code

function spaces_features_export_render($module = 'foo', $data) {
  $code = array();
  $code[] = '  $presets = array();';
  $code[] = '';
  $presets = spaces_presets();
  foreach ($data as $id) {

    // Get the preset definition
    $preset = NULL;
    $presets = spaces_presets();
    foreach (array_keys($presets) as $type) {
      if (isset($presets[$type][$id])) {
        $preset = $presets[$type][$id];
        break;
      }
    }
    if ($preset) {

      // Clear out extraneous flags
      unset($preset['disabled']);
      unset($preset['storage']);
      $code[] = '  // Exported preset: ' . $id;
      $code[] = '  $presets[\'' . $id . '\'] = ' . features_var_export($preset, '  ') . ';';
      $code[] = '';
    }
  }
  $code[] = '  return $presets;';
  $code = implode("\n", $code);
  return array(
    'spaces_presets' => $code,
  );
}