You are here

function variable_features_export_render in Strongarm 7.2

Same name and namespace in other branches
  1. 6.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 170

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_select('variable', 'v')
    ->fields('v', array(
    'name',
    'value',
  ))
    ->condition('name', $data, 'IN')
    ->orderBy('name')
    ->execute();
  foreach ($result as $object) {
    $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,
  );
}