Ejemplo n.º 1
0
 /**
  * Initialize editor
  *
  * @param int $pageId
  * @param int $templateUid
  * @return bool
  */
 public function initialize_editor($pageId, $templateUid = 0)
 {
     // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
     $this->templateService = GeneralUtility::makeInstance(ExtendedTemplateService::class);
     $this->templateService->init();
     // Gets the rootLine
     $sys_page = GeneralUtility::makeInstance(PageRepository::class);
     $rootLine = $sys_page->getRootLine($pageId);
     // This generates the constants/config + hierarchy info for the template.
     $this->templateService->runThroughTemplates($rootLine, $templateUid);
     // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
     $this->templateRow = $this->templateService->ext_getFirstTemplate($pageId, $templateUid);
     return is_array($this->templateRow);
 }
Ejemplo n.º 2
0
 /**
  * @param $pageId
  * @param int $templateUid
  *
  * @return bool
  */
 protected function initializeTsParser($pageId, $templateUid = 0)
 {
     if (!$this->tsParserInitialized) {
         $this->tsParserInitialized = true;
         $this->tsParser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService');
         // Do not log time-performance information
         $this->tsParser->tt_track = 0;
         $this->tsParser->init();
         $this->tsParser->ext_localGfxPrefix = ExtensionManagementUtility::extPath('tstemplate');
         $this->tsParser->ext_localWebGfxPrefix = $GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('tstemplate');
         $this->tsParserTplRow = $this->tsParser->ext_getFirstTemplate($pageId, $templateUid);
         if (is_array($this->tsParserTplRow)) {
             /**
              * @var t3lib_pageSelect
              */
             $sysPageRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
             $rootLine = $sysPageRepository->getRootLine($pageId);
             // This generates the constants/config + hierarchy info for the template.
             $this->tsParser->runThroughTemplates($rootLine, $templateUid);
             // The editable constants are returned in an array.
             $this->tsParserConstants = $this->tsParser->generateConfig_constants();
             // The returned constants are sorted in categories, that goes into the $tmpl->categories array
             $this->tsParser->ext_categorizeEditableConstants($this->tsParserConstants);
             $this->tsParser->ext_regObjectPositions($this->tsParserTplRow['constants']);
             // This array will contain key=[expanded constantname], value=linenumber in template. (after edit_divider, if any)
             return true;
         } else {
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 3
0
 /**
  * Initialize editor
  *
  * Initializes the module.
  * Done in this function because we may need to re-initialize if data is submitted!
  *
  * @param int $pageId
  * @param int $template_uid
  * @return bool
  */
 public function initialize_editor($pageId, $template_uid = 0)
 {
     $this->templateService = GeneralUtility::makeInstance(ExtendedTemplateService::class);
     $this->templateService->init();
     // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
     $this->templateRow = $this->templateService->ext_getFirstTemplate($pageId, $template_uid);
     // IF there was a template...
     if (is_array($this->templateRow)) {
         // Gets the rootLine
         $sys_page = GeneralUtility::makeInstance(PageRepository::class);
         $rootLine = $sys_page->getRootLine($pageId);
         // This generates the constants/config + hierarchy info for the template.
         $this->templateService->runThroughTemplates($rootLine, $template_uid);
         // The editable constants are returned in an array.
         $this->constants = $this->templateService->generateConfig_constants();
         // The returned constants are sorted in categories, that goes into the $tmpl->categories array
         $this->templateService->ext_categorizeEditableConstants($this->constants);
         // This array will contain key=[expanded constant name], value=line number in template. (after edit_divider, if any)
         $this->templateService->ext_regObjectPositions($this->templateRow['constants']);
         return true;
     }
     return false;
 }