You are here

function language_hierarchy_calculate_depth in Language Hierarchy 8

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

Get the depth of a language inside hierarchy.

Parameters

\Drupal\language\ConfigurableLanguageInterface $language: The language to calculate depth for.

Return value

int The number of ancestors this language has.

1 call to language_hierarchy_calculate_depth()
language_hierarchy_form_language_admin_overview_form_alter in ./language_hierarchy.module
Implements hook_form_FORM_ID_alter() for language_admin_overview_form().

File

./language_hierarchy.module, line 228
Add sublanguage handling functionality to Drupal.

Code

function language_hierarchy_calculate_depth(ConfigurableLanguageInterface $language) {
  $depth = count(language_hierarchy_get_ancestors($language));
  return $depth;
}