function LanguageConfigurationTest::getHighestConfigurableLanguageWeight
Helper to get maximum weight of configurable (unlocked) languages.
Return value
int Maximum weight of configurable languages.
2 calls to LanguageConfigurationTest::getHighestConfigurableLanguageWeight()
- LanguageConfigurationTest::checkConfigurableLanguageWeight in core/
modules/ language/ tests/ src/ Functional/ LanguageConfigurationTest.php  - Validates system languages are ordered after configurable languages.
 - LanguageConfigurationTest::testLanguageConfigurationWeight in core/
modules/ language/ tests/ src/ Functional/ LanguageConfigurationTest.php  - Functional tests for setting system language weight on adding, editing and deleting languages.
 
File
- 
              core/
modules/ language/ tests/ src/ Functional/ LanguageConfigurationTest.php, line 219  
Class
- LanguageConfigurationTest
 - Adds and configures languages to check negotiation changes.
 
Namespace
Drupal\Tests\language\FunctionalCode
protected function getHighestConfigurableLanguageWeight() : int {
  $max_weight = 0;
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('configurable_language');
  $storage->resetCache();
  /** @var \Drupal\Core\Language\LanguageInterface[] $languages */
  $languages = $storage->loadMultiple();
  foreach ($languages as $language) {
    if (!$language->isLocked()) {
      $max_weight = max($max_weight, $language->getWeight());
    }
  }
  return $max_weight;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.