function domain_locale_features_export_render in Domain Locale 7
Implements hook_features_export_render().
File
- ./domain_locale.features.inc, line 30 
- Features integration for Domain Locale.
Code
function domain_locale_features_export_render($module_name, $data, $export = NULL) {
  // TODO remake this function
  domain_locale_features_load($module_name, 'domain_locale_default_locales', FALSE);
  $code = array();
  $code[] = '  $locales = array();';
  // Set the wipe tables item.
  if ($wipe = domain_locale_features_export_wipe_tables_code($data, $code, $export, 'locales') && empty($export)) {
    // domains to locales
    // list all domain locales
    foreach (domain_locale_list(FALSE) as $domain_id => $languages) {
      $this_domain = domain_lookup($domain_id);
      foreach ($languages as $language => $weight) {
        $data[$this_domain['machine_name'] . '__locale-placeholder__' . $language] = $this_domain['machine_name'] . '__locale-placeholder__' . $language;
      }
    }
  }
  // remove wipe form $data as it is already on $code
  unset($data['wipe-domain-locale-tables']);
  // Get all enabled languages for each domain_id
  $locales = domain_locale_list(FALSE);
  $exportable = array();
  foreach ($data as $name) {
    //dpm($name);
    // Separate domain machine-name and language code
    $items = explode('__locale-placeholder__', $name);
    if (isset($items[1])) {
      $domain_machine_name = $items[0];
      $language = $items[1];
      // Get the domain information
      $domain_info = domain_machine_name_load($domain_machine_name);
      if (isset($locales[$domain_info['domain_id']][$language]['weight'])) {
        // Get the weight of the language
        $weight = $locales[$domain_info['domain_id']][$language]['weight'];
        //write the locale data on the exportable array
        $exportable[$domain_machine_name][$language] = $weight;
      }
    }
  }
  // Write $exportable it it exists.
  if (isset($exportable)) {
    foreach ($exportable as $export_name => $export_vars) {
      $code[] = "  \$locales['" . $export_name . "'] = " . features_var_export($export_vars, '  ') . ";";
    }
  }
  // Close the code
  $code[] = "\n  return \$locales;";
  // Return the output
  $output = implode("\n", $code);
  return array(
    'domain_locale_default_locales' => $output,
  );
}