[TASK] Separate ext:statictemplates code from core
[Packages/TYPO3.CMS.git] / typo3 / sysext / tstemplate / Classes / Controller / TypoScriptTemplateModuleController.php
index a6ac1fa..de1902c 100644 (file)
@@ -338,18 +338,23 @@ class TypoScriptTemplateModuleController extends \TYPO3\CMS\Backend\Module\BaseS
                $theOutput .= $flashMessage->render();
                // New standard?
                if ($newStandardTemplate) {
-                       // check wether statictemplates are supported
-                       if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('statictemplates')) {
-                               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('title,uid', 'static_template', '', '', 'title');
-                               $opt = '';
-                               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                                       if (substr(trim($row['title']), 0, 8) == 'template') {
-                                               $opt .= '<option value="' . $row['uid'] . '">' . htmlspecialchars($row['title']) . '</option>';
-                                       }
-                               }
-                               $GLOBALS['TYPO3_DB']->sql_free_result($res);
-                               $selector = '<select name="createStandard"><option></option>' . $opt . '</select><br />';
-                               $staticsText = ', optionally based on one of the standard templates';
+                       // Hook to change output, implemented for statictemplates
+                       if (isset(
+                               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateModuleController']['newStandardTemplateView']
+                       )) {
+                               $selector = '';
+                               $staticsText = '';
+                               $reference = array(
+                                       'selectorHtml' => &$selector,
+                                       'staticsText' => &$staticsText
+                               );
+                               \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction(
+                                       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateModuleController']['newStandardTemplateView'],
+                                       $reference,
+                                       $this
+                               );
+                               $selector = $reference['selectorHtml'];
+                               $staticsText = $reference['staticsText'];
                        } else {
                                $selector = '<input type="hidden" name="createStandard" value="" />';
                                $staticsText = '';
@@ -422,16 +427,20 @@ class TypoScriptTemplateModuleController extends \TYPO3\CMS\Backend\Module\BaseS
                        /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */
                        $tce->stripslashes_values = 0;
                        $recData = array();
-                       if (intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('createStandard'))) {
-                               $staticT = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('createStandard'));
-                               $recData['sys_template']['NEW'] = array(
-                                       'pid' => $id,
-                                       'title' => $GLOBALS['LANG']->getLL('titleNewSiteStandard'),
-                                       'sorting' => 0,
-                                       'root' => 1,
-                                       'clear' => 3,
-                                       'include_static' => $staticT . ',57'
+                       // Hook to handle row data, implemented for statictemplates
+                       if (isset(
+                               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateModuleController']['newStandardTemplateHandler']
+                       )) {
+                               $reference = array(
+                                       'recData' => &$recData,
+                                       'id' => $id,
+                               );
+                               \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction(
+                                       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateModuleController']['newStandardTemplateHandler'],
+                                       $reference,
+                                       $this
                                );
+                               $recData = $reference['recData'];
                        } else {
                                $recData['sys_template']['NEW'] = array(
                                        'pid' => $id,