You are here

function _features_export_language in Features 7.2

Sets/Returns the current language to English to ensure a proper export.

Parameters

\stdClass|null $language: (optional) The language object to set, or NULL for English.

Return value

\stdClass The previously active language object. This should be kept in a variable, to restore the original language later.

3 calls to _features_export_language()
features_get_component_states in ./features.export.inc
Retrieve an array of features/components and their current states.
_drush_features_export in ./features.drush.inc
Write a module to the site dir.
_features_populate in ./features.export.inc
Populates an export array with additional components from the "pipe".

File

./features.module, line 1527
Main *.module file for the 'features' module.

Code

function _features_export_language($language = NULL) {
  $current = $GLOBALS['language'];
  if (isset($language)) {
    $GLOBALS['language'] = $language;
  }
  elseif ($GLOBALS['language']->language != 'en') {

    // Create the language object as language_default() does.
    $GLOBALS['language'] = (object) array(
      'language' => 'en',
      'name' => 'English',
      'native' => 'English',
      'direction' => 0,
      'enabled' => 1,
      'plurals' => 0,
      'formula' => '',
      'domain' => '',
      'prefix' => '',
      'weight' => 0,
      'javascript' => '',
    );
  }
  return $current;
}