You are here

function variable_features_export_render in Strongarm 6.2

Same name and namespace in other branches
  1. 7.2 strongarm.module \variable_features_export_render()

Implements hook_features_export_render().

Loads default values from the DB since it is now the system of record.

File

./strongarm.module, line 171

Code

function variable_features_export_render($module, $data) {
  ctools_include('export');
  $schema = ctools_export_get_schema('variable');
  $code = '  $export = array();' . "\n\n";
  $identifier = $schema['export']['identifier'];
  $result = db_query("SELECT * FROM {variable} WHERE name IN (" . db_placeholders($data, 'text') . ") ORDER BY name", $data);
  while ($object = db_fetch_object($result)) {
    $object = _ctools_export_unpack_object($schema, $object);
    $code .= _ctools_features_export_crud_export('variable', $object, '  ');
    $code .= "  \$export[" . ctools_var_export($object->name) . "] = \${$identifier};\n\n";
  }
  $code .= '  return $export;';
  return array(
    $schema['export']['default hook'] => $code,
  );
}