LanguageServiceProvider::isMultilingual

protected 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 72

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;
}
doc_Drupal
2016-10-29 09:23:00
Comments
Leave a Comment

Please login to continue.