class FullLanguageManager in Flags 8
Hierarchy
- class \Drupal\flags\FullLanguageManager implements FullLanguageManagerInterface
Expanded class hierarchy of FullLanguageManager
1 string reference to 'FullLanguageManager'
1 service uses FullLanguageManager
File
- src/
FullLanguageManager.php, line 12
Namespace
Drupal\flagsView source
class FullLanguageManager implements FullLanguageManagerInterface {
/**
* @var ConfigurableLanguageManagerInterface
*/
protected $languageManager;
/**
* @var ConfigFactoryInterface
*/
protected $configFactory;
/**
* FullLanguageManager constructor.
*
* @param \Drupal\Core\Language\LanguageManager $languageManager
* @param \Drupal\Core\Config\ConfigFactoryInterface
*/
public function __construct(LanguageManagerInterface $languageManager, ConfigFactoryInterface $configFactory) {
$this->languageManager = $languageManager;
$this->configFactory = $configFactory;
}
/**
* {@inheritdoc}
*/
public function getAllDefinedLanguages() {
// Get list of all configured languages.
$languages = [];
// See Drupal\language\ConfigurableLanguageManager::getLanguages() for details
$predefined = LanguageManager::getStandardLanguageList();
foreach ($predefined as $key => $value) {
$languages[$key] = new TranslatableMarkup($value[0]);
}
$config_ids = $this->configFactory
->listAll('language.entity.');
foreach ($this->configFactory
->loadMultiple($config_ids) as $config) {
$data = $config
->get();
$languages[$data['id']] = new TranslatableMarkup($data['label']);
}
asort($languages);
return $languages;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FullLanguageManager:: |
protected | property | ||
FullLanguageManager:: |
protected | property | ||
FullLanguageManager:: |
public | function |
Returns list of ALL languages including predefined and configured. Overrides FullLanguageManagerInterface:: |
|
FullLanguageManager:: |
public | function | FullLanguageManager constructor. |