You are here

function title_active_language in Title 7

Returns and optionally stores the active language.

Parameters

string $langcode: (optional) The active language to be set. If none is provided the active language is just returned.

Return value

string The active language code. Defaults to the current content language.

3 calls to title_active_language()
TitleTranslationTestCase::termLoad in tests/TitleTranslationTestCase.test
Loads a term using the given language as active language.
title_entity_presave in ./title.module
Implements hook_entity_presave().
title_entity_sync in ./title.module
Synchronize replaced fields with the regular field values.

File

./title.module, line 549

Code

function title_active_language($langcode = NULL) {
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['active_language'] =& drupal_static(__FUNCTION__);
  }
  $active_langcode =& $drupal_static_fast['active_language'];
  if (isset($langcode)) {
    $active_langcode = $langcode;
  }
  if (empty($active_langcode)) {
    $active_langcode = $GLOBALS['language_content']->language;
  }
  return $active_langcode;
}