diff --git a/core/modules/ckeditor/ckeditor.services.yml b/core/modules/ckeditor/ckeditor.services.yml index 5715789..ebd0021 100644 --- a/core/modules/ckeditor/ckeditor.services.yml +++ b/core/modules/ckeditor/ckeditor.services.yml @@ -2,3 +2,10 @@ services: plugin.manager.ckeditor.plugin: class: Drupal\ckeditor\CKEditorPluginManager arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler'] + cache.ckeditor: + class: Drupal\Core\Cache\CacheBackendInterface + tags: + - { name: cache.bin } + factory_method: get + factory_service: cache_factory + arguments: [ckeditor] diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php index 62d66d1..335003b 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php @@ -234,7 +234,7 @@ public function getJSSettings(EditorEntity $editor) { // Match the interface language code with possible pairs from ckeditor. $ckeditor_langcodes = $this->getLangcodes(); - $language_interface = $this->languageManager()->getLanguage(Language::TYPE_INTERFACE); + $language_interface = $this->languageManager->getLanguage(Language::TYPE_INTERFACE); if (isset($ckeditor_langcodes[$language_interface->id])) { $display_langcode = $language_interface->id; } @@ -275,7 +275,10 @@ private function getLangcodes() { // be expensive to calculate all the time. The cache is cleared on core // upgrades which is the only situation the CKEditor file listing should // change. - $langcodes = cache('ckeditor')->get('langcodes'); + $langcode_cache = cache('ckeditor')->get('langcodes'); + if (!empty($langcode_cache)) { + $langcodes = $langcode_cache->data; + } if (empty($langcodes)) { $langcodes = array(); // Collect languages included with CKEditor based on file listing. @@ -290,8 +293,8 @@ private function getLangcodes() { // Get language mapping if available to map to Drupal language codes. // This is configurable on the user interface and not expensive to get, // so we don't include in the cached language list. - $language_mappings = $this->moduleHandler()->moduleExists('language') ? language_get_browser_drupal_langcode_mappings() : array(); - foreach($langcodes as $langcode) { + $language_mappings = $this->moduleHandler->moduleExists('language') ? language_get_browser_drupal_langcode_mappings() : array(); + foreach ($langcodes as $langcode) { // If this language code is available in a Drupal mapping, use that // to compute a possibility for matching from the Drupal langcode to // the CKEditor langcode.