diff --git a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php index f483d88..42dbb00 100644 --- a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php @@ -10,6 +10,7 @@ use Drupal\Core\Render\RendererInterface; use Drupal\editor\Plugin\EditorBase; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\Core\State\StateInterface; use Drupal\editor\Entity\Editor; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -58,6 +59,13 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface { protected $renderer; /** + * The state key/value store. + * + * @var \Drupal\Core\State\StateInterface + */ + protected $state; + + /** * Constructs a Drupal\Component\Plugin\PluginBase object. * * @param array $configuration @@ -74,13 +82,16 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface { * The language manager. * @param \Drupal\Core\Render\RendererInterface $renderer * The renderer. + * @param \Drupal\Core\State\StateInterface $state + * The state key/value store. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, CKEditorPluginManager $ckeditor_plugin_manager, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager, RendererInterface $renderer) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, CKEditorPluginManager $ckeditor_plugin_manager, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager, RendererInterface $renderer, StateInterface $state) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->ckeditorPluginManager = $ckeditor_plugin_manager; $this->moduleHandler = $module_handler; $this->languageManager = $language_manager; $this->renderer = $renderer; + $this->state = $state; } /** @@ -94,7 +105,8 @@ public static function create(ContainerInterface $container, array $configuratio $container->get('plugin.manager.ckeditor.plugin'), $container->get('module_handler'), $container->get('language_manager'), - $container->get('renderer') + $container->get('renderer'), + $container->get('state') ); } @@ -423,8 +435,9 @@ public function buildContentsCssJSSetting(Editor $editor) { }, []); $css = array_merge($css, $plugins_css); $css = array_merge($css, _ckeditor_theme_css()); - $css = array_map(function($item) { - return $item . '?cb=' . \Drupal::state()->get('system.css_js_query_string') ?: '0'; + $query_string = '?' . $this->state->get('system.css_js_query_string') ?: '0'; + $css = array_map(function($item) use($query_string) { + return $item . $query_string; }, $css); $css = array_map('file_create_url', $css); $css = array_map('file_url_transform_relative', $css);