You are here

function language_hierarchy_get_ancestors in Language Hierarchy 7

Same name and namespace in other branches
  1. 8 language_hierarchy.module \language_hierarchy_get_ancestors()
  2. 2.x language_hierarchy.module \language_hierarchy_get_ancestors()

Returns ancestors language code of the provided language.

Parameters

$langcode: Code of language you want to retrieve parent of.

$enabled_languages_only Boolean: Determines whatever only the enabled language ancestors will be shown.

Return value

mixed Ordered array with all ancestors, most specific on the top.

11 calls to language_hierarchy_get_ancestors()
entity_translation_hierarchy_get_candidate in modules/entity_translation_hierarchy/entity_translation_hierarchy.module
Returns langcode of entity translation candidate.
i18n_menu_hierarchy_block_view_alter in modules/i18n_menu_hierarchy/i18n_menu_hierarchy.module
Implements hook_block_view().
languageHierarchyPaths::drupal_lookup_path in modules/language_hierarchy_paths/languageHierarchyPaths.class.inc
Given an alias, return its Drupal system URL if one exists. Given a Drupal system URL return one of its aliases if such a one exists. Otherwise, return FALSE.
language_hierarchy_i18n_string_textgroup_default::load_translation in includes/language_hierarchy_i18n_string_textgroup_default.class.inc
Load translation from db
language_hierarchy_i18n_string_textgroup_default::multiple_translation_load in includes/language_hierarchy_i18n_string_textgroup_default.class.inc
Load multiple translations from db

... See full list

1 string reference to 'language_hierarchy_get_ancestors'
LocaleHierarchy::offsetBuild in includes/LocaleHierarchy.class.inc

File

./language_hierarchy.module, line 383

Code

function language_hierarchy_get_ancestors($langcode, $enabled_languages_only = FALSE) {
  $ancestors = array();
  while ($ancestor = language_hierarchy_get_parent($langcode)) {

    // Check conditions on whatever to add the language ancestor to the results.
    if ($enabled_languages_only == FALSE || $ancestor->enabled == TRUE) {
      $ancestors[$ancestor->language] = $ancestor;
    }
    $langcode = $ancestor->language;
  }
  return $ancestors;
}