Fixed bug #12017: Wrong Inclusion in tceforms and tceforms_fe
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_tceforms_fe.php
index a8b64b4..8c853d7 100644 (file)
 class t3lib_TCEforms_FE extends t3lib_TCEforms {
 
        /**
+        * Constructs this object.
+        */
+       public function __construct() {
+               $this->initializeTemplateContainer();
+               parent::__construct();
+       }
+
+       /**
         * Function for wrapping labels.
         *
         * @param       string          The string to wrap
@@ -128,9 +136,10 @@ class t3lib_TCEforms_FE extends t3lib_TCEforms {
         * @return      void
         */
        public function loadJavascriptLib($lib) {
-               if (!isset($GLOBALS['TSFE']->additionalHeaderData[$lib])) {
-                       $GLOBALS['TSFE']->additionalHeaderData[$lib] = '<script type="text/javascript" src="' . $this->backPath . $lib . '"></script>';
-               }
+               /** @var $pageRenderer t3lib_PageRenderer */
+               $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
+               $pageRenderer->addJsLibrary($lib, $this->backPath . $lib);
+               
        }
 
        /**
@@ -143,10 +152,24 @@ class t3lib_TCEforms_FE extends t3lib_TCEforms {
         * @return      void
         */
        public 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 . '"') : '') . ' />';
-               }
+               /** @var $pageRenderer t3lib_PageRenderer */
+               $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
+               $pageRenderer->addCssFile($this->backPath . $href, $relation, 'screen', $title);
         }
+
+       /**
+        * Initializes an anonymous template container.
+        * The created container can be compared to alt_doc.php in backend-only disposal.
+        *
+        * @return      void
+        */
+       public function initializeTemplateContainer() {
+               t3lib_div::requireOnce(PATH_typo3 . 'template.php');
+               $GLOBALS['TBE_TEMPLATE'] = t3lib_div::makeInstance('frontendDoc');
+
+               $GLOBALS['SOBE'] = new stdClass();
+               $GLOBALS['SOBE']->doc = $GLOBALS['TBE_TEMPLATE'];
+       }
 }
 
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tceforms_fe.php']) {