Fixed bug #9613: htmlArea RTE uses JScodeLibArray to insert CSS
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / pi2 / class.tx_rtehtmlarea_pi2.php
index 8964015..ac7d64e 100644 (file)
@@ -212,10 +212,9 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                 * LOAD JS, CSS and more
                 * =======================================
                 */
-                       // Preloading the pageStyle
-               $GLOBALS['TSFE']->additionalHeaderData['rtehtmlarea-contentCSS'] = $this->getPageStyle();
-                       // Loading RTE skin style sheets
-               $GLOBALS['TSFE']->additionalHeaderData['rtehtmlarea-skin'] = $this->getSkin();
+                       // Preloading the pageStyle and including RTE skin stylesheets
+               $this->addPageStyle();
+               $this->addSkin();
                        // Loading JavaScript files and code
                $this->TCEform->additionalJS_initial = $this->loadJSfiles($this->TCEform->RTEcounter);
                $this->TCEform->additionalJS_pre['rtehtmlarea-loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter);
@@ -254,6 +253,21 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                return $item;
        }
        
+       /**
+        * Add style sheet file to document header
+        *
+        * @param       string          $key: some key identifying the style sheet
+        * @param       string          $href: uri to the style sheet file
+        * @param       string          $title: value for the title attribute of the link element
+        * @return      string          $relation: value for the rel attribute of the link element
+        * @return      void
+        */
+       protected function addStyleSheet($key, $href, $title='', $relation='stylesheet') {
+               if (!isset($GLOBALS['TSFE']->additionalHeaderData[$key])) {
+                       $GLOBALS['TSFE']->additionalHeaderData[$key] = '<link rel="' . $relation . '" type="text/css" href="' . $href . '"' . ($title ? (' title="' . $title . '"') : '') . ' />';
+               }
+       }
+       
        /**
         * Return the JS-Code for copy the HTML-Code from the editor in the hidden input field.
         * This is for submit function from the form.