Skip to content
Snippets Groups Projects
Commit e55daa30 authored by catch's avatar catch
Browse files

Issue #2606460 by Wim Leers, alexpott: Regression caused by #2557113: Enabling...

Issue #2606460 by Wim Leers, alexpott: Regression caused by #2557113: Enabling CKEditor for a text format that did not have it previously is broken
parent 5047475e
No related branches found
No related tags found
No related merge requests found
...@@ -123,7 +123,7 @@ function template_preprocess_ckeditor_settings_toolbar(&$variables) { ...@@ -123,7 +123,7 @@ function template_preprocess_ckeditor_settings_toolbar(&$variables) {
'buttons' => array(), 'buttons' => array(),
); );
$buttons = array_filter($button_row, function ($button) use ($group_name) { $buttons = array_filter($button_row, function ($button) use ($group_name) {
return $button['group'] === $group_name; return (string) $button['group'] === $group_name;
}); });
foreach ($buttons as $button) { foreach ($buttons as $button) {
$variables['active_buttons'][$row_number][$group_name]['buttons'][] = $build_button_item($button, $rtl); $variables['active_buttons'][$row_number][$group_name]['buttons'][] = $build_button_item($button, $rtl);
......
...@@ -261,6 +261,9 @@ function testNewFormat() { ...@@ -261,6 +261,9 @@ function testNewFormat() {
$expected_buttons_value = json_encode($default_settings['toolbar']['rows']); $expected_buttons_value = json_encode($default_settings['toolbar']['rows']);
$this->assertFieldByName('editor[settings][toolbar][button_groups]', $expected_buttons_value); $this->assertFieldByName('editor[settings][toolbar][button_groups]', $expected_buttons_value);
// Regression test for https://www.drupal.org/node/2606460.
$this->assertTrue(strpos($this->drupalSettings['ckeditor']['toolbarAdmin'], '<li data-drupal-ckeditor-button-name="Bold" class="ckeditor-button"><a href="#" class="cke-icon-only cke_ltr" role="button" title="bold" aria-label="bold"><span class="cke_button_icon cke_button__bold_icon">bold</span></a></li>') !== FALSE);
// Ensure the styles textarea exists and is initialized empty. // Ensure the styles textarea exists and is initialized empty.
$styles_textarea = $this->xpath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]'); $styles_textarea = $this->xpath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]');
$this->assertFieldByXPath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]', '', 'The styles textarea exists and is empty.'); $this->assertFieldByXPath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]', '', 'The styles textarea exists and is empty.');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment