class Language
Same name in this branch
- 9 core/modules/language/src/Plugin/migrate/source/Language.php \Drupal\language\Plugin\migrate\source\Language
- 9 core/modules/language/src/Plugin/Condition/Language.php \Drupal\language\Plugin\Condition\Language
- 9 core/modules/ckeditor/src/Plugin/CKEditorPlugin/Language.php \Drupal\ckeditor\Plugin\CKEditorPlugin\Language
- 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php \Drupal\Core\TypedData\Plugin\DataType\Language
- 9 core/lib/Drupal/Core/Language/Language.php \Drupal\Core\Language\Language
Same name in other branches
- 8.9.x core/modules/language/src/Plugin/migrate/source/Language.php \Drupal\language\Plugin\migrate\source\Language
- 8.9.x core/modules/language/src/Plugin/Condition/Language.php \Drupal\language\Plugin\Condition\Language
- 8.9.x core/modules/ckeditor/src/Plugin/CKEditorPlugin/Language.php \Drupal\ckeditor\Plugin\CKEditorPlugin\Language
- 8.9.x core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php \Drupal\Core\TypedData\Plugin\DataType\Language
- 8.9.x core/lib/Drupal/Core/Language/Language.php \Drupal\Core\Language\Language
- 10 core/modules/language/src/Plugin/migrate/source/Language.php \Drupal\language\Plugin\migrate\source\Language
- 10 core/modules/language/src/Plugin/Condition/Language.php \Drupal\language\Plugin\Condition\Language
- 10 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Language.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Language
- 10 core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php \Drupal\Core\TypedData\Plugin\DataType\Language
- 10 core/lib/Drupal/Core/Language/Language.php \Drupal\Core\Language\Language
- 11.x core/modules/language/src/Plugin/migrate/source/Language.php \Drupal\language\Plugin\migrate\source\Language
- 11.x core/modules/language/src/Plugin/Condition/Language.php \Drupal\language\Plugin\Condition\Language
- 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Language.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Language
- 11.x core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php \Drupal\Core\TypedData\Plugin\DataType\Language
- 11.x core/lib/Drupal/Core/Language/Language.php \Drupal\Core\Language\Language
CKEditor 5 Language plugin.
@internal Plugin classes are internal.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
- class \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault extends \Drupal\Core\Plugin\PluginBase implements \Drupal\ckeditor5\Plugin\CKEditor5PluginInterface
- class \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Language extends \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault implements \Drupal\ckeditor5\Plugin\CKEditor5PluginConfigurableInterface uses \Drupal\ckeditor5\Plugin\CKEditor5PluginConfigurableTrait
- class \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault extends \Drupal\Core\Plugin\PluginBase implements \Drupal\ckeditor5\Plugin\CKEditor5PluginInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
Expanded class hierarchy of Language
1 file declares its use of Language
- LanguagePluginTest.php in core/
modules/ ckeditor5/ tests/ src/ Unit/ LanguagePluginTest.php
394 string references to 'Language'
- AccountSettingsForm::buildForm in core/
modules/ user/ src/ AccountSettingsForm.php - Form constructor.
- block.block.umami_languageswitcher.yml in core/
profiles/ demo_umami/ config/ install/ block.block.umami_languageswitcher.yml - core/profiles/demo_umami/config/install/block.block.umami_languageswitcher.yml
- BlockContentTypeForm::form in core/
modules/ block_content/ src/ BlockContentTypeForm.php - Gets the actual form array to be built.
- BlockForm::buildVisibilityInterface in core/
modules/ block/ src/ BlockForm.php - Helper function for building the visibility UI form.
- BlockLanguageTest::testLanguageBlockVisibilityLanguageDelete in core/
modules/ block/ tests/ src/ Functional/ BlockLanguageTest.php - Tests if the visibility settings are removed if the language is deleted.
File
-
core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ Language.php, line 21
Namespace
Drupal\ckeditor5\Plugin\CKEditor5PluginView source
class Language extends CKEditor5PluginDefault implements CKEditor5PluginConfigurableInterface {
use CKEditor5PluginConfigurableTrait;
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*
* @see \Drupal\editor\Form\EditorImageDialog
* @see editor_image_upload_settings_form()
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$predefined_languages = LanguageManager::getStandardLanguageList();
$form['language_list'] = [
'#title' => $this->t('Language list'),
'#title_display' => 'invisible',
'#type' => 'select',
'#options' => [
'un' => $this->t("United Nations' official languages"),
'all' => $this->t('All @count languages', [
'@count' => count($predefined_languages),
]),
],
'#default_value' => $this->configuration['language_list'],
'#description' => $this->t('The list of languages to show in the language dropdown. The basic list will only show the <a href=":url">six official languages of the UN</a>. The extended list will show all @count languages that are available in Drupal.', [
':url' => 'https://www.un.org/en/sections/about-un/official-languages',
'@count' => count($predefined_languages),
]),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['language_list'] = $form_state->getValue('language_list');
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [
'language_list' => 'un',
];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
CKEditor5PluginConfigurableTrait::getConfiguration | public | function | |||
CKEditor5PluginConfigurableTrait::setConfiguration | public | function | |||
CKEditor5PluginDefault::__construct | public | function | 2 | ||
Language::buildConfigurationForm | public | function | |||
Language::defaultConfiguration | public | function | |||
Language::getDynamicPluginConfig | public | function | Allows a plugin to modify its static configuration. | Overrides CKEditor5PluginDefault::getDynamicPluginConfig | |
Language::submitConfigurationForm | public | function | |||
Language::validateConfigurationForm | public | function | |||
PluginInspectionInterface::getPluginDefinition | public | function | Gets the definition of the plugin implementation. | 6 | |
PluginInspectionInterface::getPluginId | public | function | Gets the plugin_id of the plugin instance. | 2 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.