diff --git a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php index 8b4dbe098013ad70fd6fb172b2dc92229016236d..135cdee2902f0b9dd4c1a90c2354f55f4f86b80a 100644 --- a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php +++ b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php @@ -116,8 +116,8 @@ public function getConfig(Editor $editor) { // Add the format_tags setting, if its button is enabled. $toolbar_buttons = CKEditorPluginManager::getEnabledButtons($editor); - if (in_array('Format', $toolbar_buttons)) { - $config['format_tags'] = $this->generateFormatTagsSetting($editor); + if (in_array('Format', $toolbar_buttons) && $format_string = $this->generateFormatTagsSetting($editor)) { + $config['format_tags'] = $format_string; } return $config; @@ -344,14 +344,15 @@ public function getButtons() { * @param \Drupal\editor\Entity\Editor $editor * A configured text editor object. * - * @return array - * An array containing the "format_tags" configuration. + * @return string|false + * A string containing the "format_tags" configuration or FALSE if the + * editor has not an associated filter format. */ protected function generateFormatTagsSetting(Editor $editor) { // When no text format is associated yet, assume no tag is allowed. // @see \Drupal\editor\EditorInterface::hasAssociatedFilterFormat() if (!$editor->hasAssociatedFilterFormat()) { - return []; + return FALSE; } $format = $editor->getFilterFormat(); diff --git a/core/modules/editor/tests/src/FunctionalJavascript/EditorAdminTest.php b/core/modules/editor/tests/src/FunctionalJavascript/EditorAdminTest.php index 51aee88140011fbbb18408ab848cf6dce8c3b5ce..3d19d3e59961f2d92649e9fdd6b5c0ec5e024e17 100644 --- a/core/modules/editor/tests/src/FunctionalJavascript/EditorAdminTest.php +++ b/core/modules/editor/tests/src/FunctionalJavascript/EditorAdminTest.php @@ -54,6 +54,7 @@ public function testEditorSelection() { $this->assertNotEmpty($assert_session->waitForText('sulaco')); $page->selectFieldOption('editor[editor]', 'ckeditor'); $this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', 'ul.ckeditor-toolbar-group-buttons')); + $this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '#ckeditor-plugin-settings')); $page->pressButton('Save configuration'); // Test that toggling the editor selection off and back on works.