function LanguageServiceProvider::isMultilingual

Same name in other branches
  1. 9 core/modules/language/src/LanguageServiceProvider.php \Drupal\language\LanguageServiceProvider::isMultilingual()
  2. 10 core/modules/language/src/LanguageServiceProvider.php \Drupal\language\LanguageServiceProvider::isMultilingual()
  3. 11.x 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.

1 call to LanguageServiceProvider::isMultilingual()
LanguageServiceProvider::register in core/modules/language/src/LanguageServiceProvider.php
Registers services to the container.

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.