From e5719a66a8055b61a30d46b42895f83e403a1001 Mon Sep 17 00:00:00 2001 From: rpnykanen Date: Tue, 9 Apr 2024 16:23:44 +0300 Subject: [PATCH] UHF-9932: Must check if the required is set and is array before anything happens. Also make sure the revering is not done when language is ltr --- modules/helfi_ckeditor/helfi_ckeditor.module | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/helfi_ckeditor/helfi_ckeditor.module b/modules/helfi_ckeditor/helfi_ckeditor.module index f7c5bb120..3a7bffe38 100644 --- a/modules/helfi_ckeditor/helfi_ckeditor.module +++ b/modules/helfi_ckeditor/helfi_ckeditor.module @@ -57,7 +57,12 @@ function helfi_ckeditor_js_settings_alter(array &$settings) { foreach ($settings['editor']['formats'] as $name => $array) { $settings['editor']['formats'][$name]['editorSettings']['language']['ui'] = $language_id; - if ($ui_language_direction === 'ltr') { + if ( + $ui_language_direction === 'ltr' && + $content_language->getDirection() == 'rtl' && + isset($settings['editor']['formats'][$name]['editorSettings']['toolbar']['items']) && + is_array($settings['editor']['formats'][$name]['editorSettings']['toolbar']['items']) + ) { $settings['editor']['formats'][$name]['editorSettings']['toolbar']['items'] = array_reverse( $settings['editor']['formats'][$name]['editorSettings']['toolbar']['items'] );