[TASK] FAL: Hard-coded flexform on storage creation
[Packages/TYPO3.CMS.git] / typo3 / sysext / statictemplates / Classes / StaticTemplatesHook.php
1 <?php
2 namespace TYPO3\CMS\Statictemplates;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * (c) 2009-2011 Benjamin Mack (benn@typo3.org)
9 * All rights reserved
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 * A copy is found in the textfile GPL.txt and important notices to the license
20 * from the author is found in LICENSE.txt distributed with these scripts.
21 *
22 *
23 * This script is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * This copyright notice MUST APPEAR in all copies of the script!
29 ***************************************************************/
30 /**
31 * Statictemplates
32 *
33 * @author Kasper Skårhøj (kasperYYYY@typo3.com)
34 * @author Benjamin Mack (benni@typo3.org)
35 */
36 class StaticTemplatesHook {
37
38 /**
39 * Includes static template records from static_template table, loaded through a hook
40 *
41 * @param array $params
42 * @param object $pObj
43 * @return void
44 */
45 public function includeStaticTypoScriptSources(&$params, &$pObj) {
46 // Static Template Records (static_template): include_static is a list of static templates to include
47 if (trim($params['row']['include_static'])) {
48 $includeStaticArr = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $params['row']['include_static']);
49 // Traversing list
50 foreach ($includeStaticArr as $id) {
51 // If $id is not already included ...
52 if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($params['idList'], ('static_' . $id))) {
53 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'static_template', 'uid = ' . intval($id));
54 // ... there was a template, then we fetch that
55 if ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
56 $subrow = $pObj->prependStaticExtra($subrow);
57 $pObj->processTemplate($subrow, $params['idList'] . ',static_' . $id, $params['pid'], 'static_' . $id, $params['templateId']);
58 }
59 $GLOBALS['TYPO3_DB']->sql_free_result($res);
60 }
61 }
62 }
63 }
64
65 }
66
67 ?>