@@ -423,11 +423,15 @@ public function generate()
423423 // Store tiny mce fields
424424 if ($ arrField ['eval ' ]['rte ' ] && strncmp ($ arrField ['eval ' ]['rte ' ], 'tiny ' , 4 ) === 0 )
425425 {
426- $ GLOBALS ['TL_RTE ' ]['tinyMCE ' ][$ this ->strField . '_ ' . $ strKey ] = array (
427- 'id ' => $ this ->strField . '_ ' . $ strKey ,
428- 'file ' => 'tinyMCE ' ,
429- 'type ' => null
430- );
426+ foreach ($ this ->varValue as $ row => $ value ) {
427+ $ tinyId = 'ctrl_ ' . $ this ->strField . '_row ' . $ row . '_ ' . $ strKey ;
428+
429+ $ GLOBALS ['TL_RTE ' ]['tinyMCE ' ][$ tinyId ] = array (
430+ 'id ' => $ tinyId ,
431+ 'file ' => 'tinyMCE ' ,
432+ 'type ' => null
433+ );
434+ }
431435
432436 $ arrTinyMCE [] = $ strKey ;
433437 }
@@ -562,7 +566,7 @@ public function generate()
562566 // Tiny MCE
563567 if ($ arrField ['eval ' ]['rte ' ] && strncmp ($ arrField ['eval ' ]['rte ' ], 'tiny ' , 4 ) === 0 )
564568 {
565- $ tinyMce = $ this ->getMcWTinyMCEString ($ objWidget ->id );
569+ $ tinyMce = $ this ->getMcWTinyMCEString ($ objWidget ->id , $ arrField );
566570 $ arrField ['eval ' ]['tl_class ' ] .= ' tinymce ' ;
567571 }
568572
@@ -749,12 +753,39 @@ protected function getMcWDatePickerString($strId, $strKey, $rgxp)
749753 }
750754 }
751755
752- protected function getMcWTinyMCEString ($ strId )
756+ protected function getMcWTinyMCEString ($ strId, $ arrField )
753757 {
754- return "<script>
758+ if (version_compare (VERSION , '3.3 ' , '< ' ))
759+ {
760+ return "<script>
755761 tinyMCE.execCommand('mceAddControl', false, 'ctrl_ " . $ strId . "');
756762 $('ctrl_ " . $ strId . "').erase('required');
757763 </script> " ;
764+ }
765+
766+ list ($ file , $ type ) = explode ('| ' , $ arrField ['eval ' ]['rte ' ], 2 );
767+
768+ if (!file_exists (TL_ROOT . '/system/config/ ' . $ file . '.php ' ))
769+ {
770+ throw new \Exception (sprintf ('Cannot find editor configuration file "%s.php" ' , $ file ));
771+ }
772+
773+ // Backwards compatibility
774+ $ language = substr ($ GLOBALS ['TL_LANGUAGE ' ], 0 , 2 );
775+
776+ if (!file_exists (TL_ROOT . '/assets/tinymce/langs/ ' . $ language . '.js ' ))
777+ {
778+ $ language = 'en ' ;
779+ }
780+
781+ $ selector = 'ctrl_ ' . $ strId ;
782+
783+ ob_start ();
784+ include TL_ROOT . '/system/config/ ' . $ file . '.php ' ;
785+ $ editor = ob_get_contents ();
786+ ob_end_clean ();
787+
788+ return $ editor ;
758789 }
759790
760791 /**
0 commit comments