diff --git a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php index 949c8e5..2bf38c7 100644 --- a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php @@ -7,12 +7,12 @@ namespace Drupal\ckeditor\Plugin\Editor; -use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\ckeditor\CKEditorPluginManager; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Render\Element; +use Drupal\Core\Render\RendererInterface; use Drupal\editor\Plugin\EditorBase; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\editor\Entity\Editor as EditorEntity; @@ -56,6 +56,13 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface { protected $ckeditorPluginManager; /** + * The renderer service. + * + * @var \Drupal\Core\Render\RendererInterface + */ + protected $renderer; + + /** * Constructs a Drupal\Component\Plugin\PluginBase object. * * @param array $configuration @@ -70,12 +77,15 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface { * The module handler to invoke hooks on. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. + * @param \Drupal\Core\Render\RendererInterface $renderer + * The renderer service. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, CKEditorPluginManager $ckeditor_plugin_manager, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, CKEditorPluginManager $ckeditor_plugin_manager, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager, RendererInterface $renderer) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->ckeditorPluginManager = $ckeditor_plugin_manager; $this->moduleHandler = $module_handler; $this->languageManager = $language_manager; + $this->renderer = $renderer; } /** @@ -88,7 +98,8 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $container->get('plugin.manager.ckeditor.plugin'), $container->get('module_handler'), - $container->get('language_manager') + $container->get('language_manager'), + $container->get('renderer') ); } @@ -143,11 +154,11 @@ public function settingsForm(array $form, FormStateInterface $form_state, Editor '#type' => 'container', '#attached' => array( 'library' => array('ckeditor/drupal.ckeditor.admin'), - 'drupalSettings' => [ - 'ckeditor' => [ - 'toolbarAdmin' => drupal_render($ckeditor_settings_toolbar), - ], - ], + 'drupalSettings' => array( + 'ckeditor' => array( + 'toolbarAdmin' => $this->renderer->render($ckeditor_settings_toolbar), + ), + ), ), '#attributes' => array('class' => array('ckeditor-toolbar-configuration')), ); @@ -218,7 +229,7 @@ public function settingsForm(array $form, FormStateInterface $form_state, Editor $form['hidden_ckeditor'] = array( '#markup' => '', '#attached' => array( - 'drupalSettings' => ['ckeditor' => ['hiddenCKEditorConfig' => $config]], + 'drupalSettings' => array('ckeditor' => array('hiddenCKEditorConfig' => $config)), ), );