diff -u b/core/modules/ckeditor/ckeditor.libraries.yml b/core/modules/ckeditor/ckeditor.libraries.yml --- b/core/modules/ckeditor/ckeditor.libraries.yml +++ b/core/modules/ckeditor/ckeditor.libraries.yml @@ -78,9 +78,7 @@ dependencies: - core/jquery - core/drupal - - core/jquery.once - core/drupal.vertical-tabs - - core/drupalSettings # Ensure to run after ckeditor/drupal.ckeditor.admin. - ckeditor/drupal.ckeditor.admin diff -u b/core/modules/ckeditor/config/schema/ckeditor.schema.yml b/core/modules/ckeditor/config/schema/ckeditor.schema.yml --- b/core/modules/ckeditor/config/schema/ckeditor.schema.yml +++ b/core/modules/ckeditor/config/schema/ckeditor.schema.yml @@ -38,9 +38,9 @@ type: mapping label: 'Language' mapping: - list_type: + language_list_type: type: string - label: 'Language list ID' + label: 'Language list type ID' # Plugin \Drupal\ckeditor\Plugin\ckeditor\plugin\StylesCombo ckeditor.plugin.stylescombo: diff -u b/core/modules/ckeditor/js/ckeditor.language.admin.js b/core/modules/ckeditor/js/ckeditor.language.admin.js --- b/core/modules/ckeditor/js/ckeditor.language.admin.js +++ b/core/modules/ckeditor/js/ckeditor.language.admin.js @@ -8,7 +8,7 @@ Drupal.behaviors.ckeditorLanguageSettingsSummary = { attach: function () { $('#edit-editor-settings-plugins-language').drupalSetSummary(function (context) { - return $('#edit-editor-settings-plugins-language-list-type option:selected').text(); + return $('#edit-editor-settings-plugins-language-language-list-type option:selected').text(); }); } }; diff -u b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Language.php b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Language.php --- b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Language.php +++ b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Language.php @@ -53,20 +53,20 @@ * {@inheritdoc} */ public function getConfig(Editor $editor) { - $language_list = array(); - $config = array('list_type' => 'un'); + $language_list = []; + $config = ['language_list_type' => 'un']; $settings = $editor->getSettings(); if (isset($settings['plugins']['language'])) { $config = $settings['plugins']['language']; } - $predefined_languages = ($config['list_type'] == 'all') ? + $predefined_languages = ($config['language_list_type'] === '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. + // 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. foreach ($predefined_languages as $langcode => $language) { $english_name = $language[0]; $direction = empty($language[2]) ? NULL : $language[2]; @@ -80,9 +80,7 @@ // Sort on full language name. ksort($language_list); - $config = array( - 'language_list' => array_values($language_list), - ); + $config = ['language_list' => array_values($language_list)]; return $config; } @@ -93,7 +91,10 @@ return array( 'Language' => array( 'label' => $this->t('Language'), - 'image_alternative' => '' . $this->t('Language') . '', + 'image_alternative' => [ + '#type' => 'inline_template', + '#template' => '' . $this->t('Language') . '', + ], ), ); } @@ -103,29 +104,27 @@ */ public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) { // Defaults. - $config = array('list_type' => 'un'); + $config = ['language_list_type' => 'un']; $settings = $editor->getSettings(); if (isset($settings['plugins']['language'])) { $config = $settings['plugins']['language']; } $predefined_languages = LanguageManager::getStandardLanguageList(); - $form['list_type'] = array( + $form['language_list_type'] = array( '#title' => $this->t('Language list type'), '#title_display' => 'invisible', '#type' => 'select', - '#options' => array( - 'un' => $this->t('United Nations subset'), - 'all' => $this->t('All @count languages', array('@count' => sizeof($predefined_languages))), - ), - '#default_value' => $config['list_type'], - '#description' => $this->t('The list of languages to show in the language dropdown. The basic list will only show the six official languages of the UN. The extended list will show all @count languages that are available in Drupal.', array( - '@url' => Url::fromUri('http://www.un.org/en/aboutun/languages.shtml/')->toString(), - '@count' => sizeof($predefined_languages), - )), - '#attached' => array( - 'library' => array('ckeditor/drupal.ckeditor.language.admin'), - ), + '#options' => [ + 'un' => $this->t("United Nations' official languages"), + 'all' => $this->t('All @count languages', ['@count' => count($predefined_languages)]), + ], + '#default_value' => $config['language_list_type'], + '#description' => $this->t('The list of languages to show in the language dropdown. The basic list will only show the six official languages of the UN. The extended list will show all @count languages that are available in Drupal.', [ + ':url' => Url::fromUri('http://www.un.org/en/aboutun/languages.shtml/')->toString(), + '@count' => count($predefined_languages), + ]), + '#attached' => ['library' => ['ckeditor/drupal.ckeditor.language.admin']], ); return $form; diff -u b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php --- b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php @@ -135,11 +135,7 @@ ), ), ), - 'plugins' => array( - 'language' => array( - 'list_type' => 'un', - ), - ), + 'plugins' => ['language' => ['language_list_type' => 'un']], ); } diff -u b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php --- b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php +++ b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php @@ -109,11 +109,7 @@ ), ), ), - 'plugins' => array( - 'language' => array( - 'list_type' => 'un', - ), - ), + 'plugins' => ['language' => ['language_list_type' => 'un']], ); $this->assertIdentical($this->castSafeStrings($ckeditor->getDefaultSettings()), $expected_default_settings); diff -u b/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php b/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php --- b/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php +++ b/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php @@ -23,7 +23,7 @@ * {@inheritdoc} */ public function setUp() { - $this->plugin = new Language(array(), $this->randomMachineName(), array()); + $this->plugin = new Language([], $this->randomMachineName(), []); } /** @@ -41,13 +41,13 @@ * * @dataProvider providerGetConfig */ - public function testGetConfig($list_type, $expected_number) { + public function testGetConfig($language_list_type, $expected_number) { $editor = $this->getMockBuilder('Drupal\editor\Entity\Editor') ->disableOriginalConstructor() ->getMock(); $editor->expects($this->once()) ->method('getSettings') - ->willReturn(['plugins' => ['language' => ['list_type' => $list_type]]]); + ->willReturn(['plugins' => ['language' => ['language_list_type' => $language_list_type]]]); $config = $this->plugin->getConfig($editor); only in patch2: unchanged: --- a/core/lib/Drupal/Core/Language/Language.php +++ b/core/lib/Drupal/Core/Language/Language.php @@ -21,13 +21,13 @@ class Language implements LanguageInterface { * * @var array */ - public static $defaultValues = array( + public static $defaultValues = [ 'id' => 'en', 'name' => 'English', 'direction' => self::DIRECTION_LTR, 'weight' => 0, 'locked' => FALSE, - ); + ]; // Properties within the Language are set up as the default language. @@ -79,7 +79,7 @@ class Language implements LanguageInterface { * An array of property values, keyed by property name, used to construct * the language. */ - public function __construct(array $values = array()) { + public function __construct(array $values = []) { // Set all the provided properties for the language. foreach ($values as $key => $value) { if (property_exists($this, $key)) {