[BUGFIX] SQL error in install tool if no root page available
[Packages/TYPO3.CMS.git] / typo3 / sysext / t3editor / Classes / FormWizard.php
1 <?php
2 namespace TYPO3\CMS\T3Editor;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2007-2013 Tobias Liebig <mail_typo3@etobi.de>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29
30 /**
31 * Wizard for tceforms
32 *
33 * @author Tobias Liebig <mail_typo3@etobi.de>
34 */
35 class FormWizard {
36
37 /**
38 * Main function
39 *
40 * @param array $parameters
41 * @param object $pObj
42 * @return string|NULL
43 */
44 public function main($parameters, $pObj) {
45 $t3editor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\T3Editor\\T3Editor');
46 if (!$t3editor->isEnabled()) {
47 return;
48 }
49 if ($parameters['params']['format'] !== '') {
50 $t3editor->setModeByType($parameters['params']['format']);
51 } else {
52 $t3editor->setMode(\TYPO3\CMS\T3Editor\T3Editor::MODE_MIXED);
53 }
54 $config = $GLOBALS['TCA'][$parameters['table']]['columns'][$parameters['field']]['config'];
55 $doc = $GLOBALS['SOBE']->doc;
56 $attributes = 'rows="' . $config['rows'] . '" ' . 'cols="' . $config['cols'] . '" ' . 'wrap="off" ' . 'style="' . $config['wizards']['t3editor']['params']['style'] . '" ' . 'onchange="' . $parameters['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] . '" ';
57 $parameters['item'] = '';
58 $parameters['item'] .= $t3editor->getCodeEditor($parameters['itemName'], 'fixed-font enable-tab', $parameters['row'][$parameters['field']], $attributes, $parameters['table'] . ' > ' . $parameters['field'], array(
59 'target' => intval($pObj->target)
60 ));
61 $parameters['item'] .= $t3editor->getJavascriptCode($doc);
62 return '';
63 }
64
65 }
66
67
68 ?>