You are here

protected function LanguageServiceProvider::isMultilingual in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/language/src/LanguageServiceProvider.php \Drupal\language\LanguageServiceProvider::isMultilingual()
  2. 9 core/modules/language/src/LanguageServiceProvider.php \Drupal\language\LanguageServiceProvider::isMultilingual()

Checks whether the site is multilingual.

Return value

bool TRUE if the site is multilingual, FALSE otherwise.

File

core/modules/language/src/LanguageServiceProvider.php, line 65

Class

LanguageServiceProvider
Overrides the language_manager service to point to language's module one.

Namespace

Drupal\language

Code

protected function isMultilingual() {

  // Assign the prefix to a local variable so it can be used in an anonymous
  // function.
  $prefix = static::CONFIG_PREFIX;

  // @todo Try to swap out for config.storage to take advantage of database
  //   and caching. This might prove difficult as this is called before the
  //   container has finished building.
  $config_storage = BootstrapConfigStorageFactory::get();
  $config_ids = array_filter($config_storage
    ->listAll($prefix), function ($config_id) use ($prefix) {
    return $config_id != $prefix . LanguageInterface::LANGCODE_NOT_SPECIFIED && $config_id != $prefix . LanguageInterface::LANGCODE_NOT_APPLICABLE;
  });
  return count($config_ids) > 1;
}