function Language::getDynamicPluginConfig
Same name in other branches
- 10 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Language.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Language::getDynamicPluginConfig()
- 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Language.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Language::getDynamicPluginConfig()
Overrides CKEditor5PluginDefault::getDynamicPluginConfig
File
-
core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ Language.php, line 28
Class
- Language
- CKEditor 5 Language plugin.
Namespace
Drupal\ckeditor5\Plugin\CKEditor5PluginCode
public function getDynamicPluginConfig(array $static_plugin_config, EditorInterface $editor) : array {
$predefined_languages = $this->configuration['language_list'] === 'all' ? LanguageManager::getStandardLanguageList() : LanguageManager::getUnitedNationsLanguageList();
// Generate the language_list setting as expected by the CKEditor Language
// plugin, but key the values by the full language name so that we can sort
// them later on.
$language_list = [];
foreach ($predefined_languages as $langcode => $language) {
$english_name = $language[0];
$direction = empty($language[2]) ? NULL : $language[2];
$language_list[$english_name] = [
'title' => $english_name,
'languageCode' => $langcode,
];
if ($direction === LanguageInterface::DIRECTION_RTL) {
$language_list[$english_name]['textDirection'] = 'rtl';
}
}
// Sort on full language name.
ksort($language_list);
$dynamic_plugin_config = $static_plugin_config;
$dynamic_plugin_config['language']['textPartLanguage'] = array_values($language_list);
return $dynamic_plugin_config;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.