You are here

function variable_realm_features_export_render in Variable 7.2

Same name and namespace in other branches
  1. 7 variable_realm/variable_realm.features.inc \variable_realm_features_export_render()

Implements hook_features_export_render().

File

variable_realm/variable_realm.features.inc, line 69
Features support for Variable store.

Code

function variable_realm_features_export_render($module_name, $data, $export = NULL) {
  variable_realm_features_load($module_name, 'variable_realm_default_variables', FALSE);
  $code = array();
  $code[] = '$realm_variables = array();';
  foreach ($data as $machine_name) {
    list($realm, $key) = explode(':', $machine_name, 2);

    // limit 2 because keys can contain colons
    $variable_realm = variable_realm($realm, $key);
    $variables = $variable_realm
      ->variable_list();
    $code[] = "  \$realm_variables['{$realm}']['{$key}'] = " . features_var_export($variables) . ";";
  }
  $code[] = "\nreturn \$realm_variables;";
  $output = implode("\n", $code);
  return array(
    'variable_realm_default_variables' => $output,
  );
}