You are here

function language_hierarchy_get_descendants in Language Hierarchy 7

Returns tree of descendants for the provided language.

Parameters

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

Return value

mixed Requested language object with 'children' property containing the tree of descendants

2 calls to language_hierarchy_get_descendants()
language_hierarchy_attach_language_selector in ./language_hierarchy.module
Attach libraries to replace local tasks links with hierarchical links.
language_hierarchy_form_locale_languages_delete_form_alter in ./language_hierarchy.module
Implements hook_form_FORM_ID_alter().

File

./language_hierarchy.module, line 407

Code

function language_hierarchy_get_descendants($langcode = NULL, &$language = NULL) {
  $languages = language_list();
  if (!empty($languages[$langcode])) {
    $language = $languages[$langcode];
    $children = language_hierarchy_get_children($langcode);
    foreach ($children as $child_code => $child) {
      $language->children[$child_code] = language_hierarchy_get_descendants($child_code, $child);
    }
  }
  return $language;
}