You are here

function language_features_export_render in Features 7.2

Same name and namespace in other branches
  1. 7 includes/features.locale.inc \language_features_export_render()

Implements hook_features_export_render().

File

includes/features.locale.inc, line 55
Features integration for 'locale' module.

Code

function language_features_export_render($module, $data, $export = NULL) {
  $code = array();
  $code[] = '  $languages = array();';
  $code[] = '';
  $language_list = language_list();
  foreach ($data as $name) {

    // Only render existing languages.
    if (!empty($language_list[$name])) {
      $var = (array) $language_list[$name];

      // Unset javascript hash.
      unset($var['javascript']);
      $lang_export = features_var_export($var, '  ');
      $lang_identifier = features_var_export($name);
      $code[] = "  // Exported language: {$name}.";
      $code[] = "  \$languages[{$lang_identifier}] = {$lang_export};";
    }
  }
  $code[] = '  return $languages;';
  $code = implode("\n", $code);
  return array(
    'locale_default_languages' => $code,
  );
}