core/modules/ckeditor5/ckeditor5.module | 13 ++++++------- .../ckeditor5/src/Plugin/CKEditor5Plugin/CodeBlock.php | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/modules/ckeditor5/ckeditor5.module b/core/modules/ckeditor5/ckeditor5.module index a09014c719..89d7699a28 100644 --- a/core/modules/ckeditor5/ckeditor5.module +++ b/core/modules/ckeditor5/ckeditor5.module @@ -17,13 +17,12 @@ use Drupal\Core\Ajax\ReplaceCommand; use Drupal\Core\Ajax\RemoveCommand; use Drupal\Core\Asset\AttachedAssetsInterface; -use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; -use Drupal\editor\Entity\Editor; +use Drupal\editor\EditorInterface; use Symfony\Component\Validator\Constraints\Choice; /** @@ -652,11 +651,11 @@ function _ckeditor5_theme_css($theme = NULL): array { } /** - * Implements hook_entity_presave(). + * Implements hook_ENTITY_TYPE_presave() for editor entities. */ -function ckeditor5_entity_presave(EntityInterface $entity) { - if ($entity instanceof Editor && $entity->getEditor() === 'ckeditor5') { - $settings = $entity->getSettings(); +function ckeditor5_editor_presave(EditorInterface $editor) { + if ($editor->getEditor() === 'ckeditor5') { + $settings = $editor->getSettings(); if (in_array('codeBlock', $settings['toolbar']['items'], TRUE) && !isset($settings['plugins']['ckeditor5_codeBlock'])) { // @see \Drupal\ckeditor5\Plugin\CKEditor5Plugin\CodeBlock::defaultConfiguration() $settings['plugins']['ckeditor5_codeBlock'] = [ @@ -677,7 +676,7 @@ function ckeditor5_entity_presave(EntityInterface $entity) { ['label' => 'XML', 'language' => 'xml'], ], ]; - $entity->setSettings($settings); + $editor->setSettings($settings); } } } diff --git a/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/CodeBlock.php b/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/CodeBlock.php index 5b745a35c1..f05fbaafa0 100644 --- a/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/CodeBlock.php +++ b/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/CodeBlock.php @@ -25,9 +25,9 @@ class CodeBlock extends CKEditor5PluginDefault implements CKEditor5PluginConfigu */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['languages'] = [ - '#title' => $this->t('Code Block Languages'), + '#title' => $this->t('Programming Languages'), '#type' => 'textarea', - '#description' => $this->t('A list of code block languages that will be provided in the "Code Block" dropdown. Enter one value per line, in the format key|label. Example: php|PHP'), + '#description' => $this->t('A list of programming languages that will be provided in the "Code Block" dropdown. Enter one value per line, in the format key|label. Example: php|PHP.'), ]; if (!empty($this->configuration['languages'])) { $as_selectors = '';