aee17adedcfca144a17a15d12bcf8e581517dba5
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / FrontendEditing / FrontendEditingController.php
1 <?php
2 namespace TYPO3\CMS\Core\FrontendEditing;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2008-2011 Jeff Segars <jeff@webempoweredchurch.org>
8 * (c) 2008-2011 David Slayback <dave@webempoweredchurch.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 * Controller class for frontend editing.
32 *
33 * @author Jeff Segars <jeff@webempoweredchurch.org>
34 * @author David Slayback <dave@webempoweredchurch.org>
35 * @package TYPO3
36 * @subpackage t3lib
37 */
38 class FrontendEditingController {
39
40 /**
41 * GET/POST parameters for the FE editing.
42 * Accessed as $GLOBALS['BE_USER']->frontendEdit->TSFE_EDIT, thus public
43 *
44 * @var array
45 */
46 public $TSFE_EDIT;
47
48 /**
49 * TCEmain object.
50 *
51 * @var t3lib_tcemain
52 */
53 protected $tce;
54
55 /**
56 * Initializes configuration options.
57 *
58 * @return void
59 */
60 public function initConfigOptions() {
61 $this->TSFE_EDIT = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('TSFE_EDIT');
62 // Include classes for editing IF editing module in Admin Panel is open
63 if ($GLOBALS['BE_USER']->isFrontendEditingActive()) {
64 $GLOBALS['TSFE']->includeTCA();
65 if ($this->isEditAction()) {
66 $this->editAction();
67 }
68 }
69 }
70
71 /**
72 * Generates the "edit panels" which can be shown for a page or records on a page when the Admin Panel is enabled for a backend users surfing the frontend.
73 * With the "edit panel" the user will see buttons with links to editing, moving, hiding, deleting the element
74 * This function is used for the cObject EDITPANEL and the stdWrap property ".editPanel"
75 *
76 * @param string $content A content string containing the content related to the edit panel. For cObject "EDITPANEL" this is empty but not so for the stdWrap property. The edit panel is appended to this string and returned.
77 * @param array $conf TypoScript configuration properties for the editPanel
78 * @param string $currentRecord The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW
79 * @param array $dataArray Alternative data array to use. Default is $this->data
80 * @return string The input content string with the editPanel appended. This function returns only an edit panel appended to the content string if a backend user is logged in (and has the correct permissions). Otherwise the content string is directly returned.
81 */
82 public function displayEditPanel($content, array $conf, $currentRecord, array $dataArray) {
83 if ($conf['newRecordFromTable']) {
84 $currentRecord = $conf['newRecordFromTable'] . ':NEW';
85 $conf['allow'] = 'new';
86 $checkEditAccessInternals = FALSE;
87 } else {
88 $checkEditAccessInternals = TRUE;
89 }
90 list($table, $uid) = explode(':', $currentRecord);
91 // Page ID for new records, 0 if not specified
92 $newRecordPid = intval($conf['newRecordInPid']);
93 if (!$conf['onlyCurrentPid'] || $dataArray['pid'] == $GLOBALS['TSFE']->id) {
94 if ($table == 'pages') {
95 $newUid = $uid;
96 } else {
97 if ($conf['newRecordFromTable']) {
98 $newUid = $GLOBALS['TSFE']->id;
99 if ($newRecordPid) {
100 $newUid = $newRecordPid;
101 }
102 } else {
103 $newUid = -1 * $uid;
104 }
105 }
106 }
107 if ((($GLOBALS['TSFE']->displayEditIcons && $table) && $this->allowedToEdit($table, $dataArray, $conf, $checkEditAccessInternals)) && $this->allowedToEditLanguage($table, $dataArray)) {
108 $editClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['edit'];
109 if ($editClass) {
110 $edit = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($editClass, FALSE);
111 if (is_object($edit)) {
112 $allowedActions = $this->getAllowedEditActions($table, $conf, $dataArray['pid']);
113 $content = $edit->editPanel($content, $conf, $currentRecord, $dataArray, $table, $allowedActions, $newUid, $this->getHiddenFields($dataArray));
114 }
115 }
116 }
117 return $content;
118 }
119
120 /**
121 * Adds an edit icon to the content string. The edit icon links to alt_doc.php with proper parameters for editing the table/fields of the context.
122 * This implements TYPO3 context sensitive editing facilities. Only backend users will have access (if properly configured as well).
123 *
124 * @param string $content The content to which the edit icons should be appended
125 * @param string $params The parameters defining which table and fields to edit. Syntax is [tablename]:[fieldname],[fieldname],[fieldname],... OR [fieldname],[fieldname],[fieldname],... (basically "[tablename]:" is optional, default table is the one of the "current record" used in the function). The fieldlist is sent as "&columnsOnly=" parameter to alt_doc.php
126 * @param array $conf TypoScript properties for configuring the edit icons.
127 * @param string $currentRecord The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW
128 * @param array $dataArray Alternative data array to use. Default is $this->data
129 * @param string $addUrlParamStr Additional URL parameters for the link pointing to alt_doc.php
130 * @return string The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content.
131 */
132 public function displayEditIcons($content, $params, array $conf = array(), $currentRecord = '', array $dataArray = array(), $addUrlParamStr = '') {
133 // Check incoming params:
134 list($currentRecordTable, $currentRecordUID) = explode(':', $currentRecord);
135 list($fieldList, $table) = array_reverse(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $params, 1));
136 // Reverse the array because table is optional
137 if (!$table) {
138 $table = $currentRecordTable;
139 } elseif ($table != $currentRecordTable) {
140 // If the table is set as the first parameter, and does not match the table of the current record, then just return.
141 return $content;
142 }
143 $editUid = $dataArray['_LOCALIZED_UID'] ? $dataArray['_LOCALIZED_UID'] : $currentRecordUID;
144 // Edit icons imply that the editing action is generally allowed, assuming page and content element permissions permit it.
145 if (!array_key_exists('allow', $conf)) {
146 $conf['allow'] = 'edit';
147 }
148 if (((($GLOBALS['TSFE']->displayFieldEditIcons && $table) && $this->allowedToEdit($table, $dataArray, $conf)) && $fieldList) && $this->allowedToEditLanguage($table, $dataArray)) {
149 $editClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['edit'];
150 if ($editClass) {
151 $edit = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($editClass);
152 if (is_object($edit)) {
153 $content = $edit->editIcons($content, $params, $conf, $currentRecord, $dataArray, $addUrlParamStr, $table, $editUid, $fieldList);
154 }
155 }
156 }
157 return $content;
158 }
159
160 /*****************************************************
161 *
162 * Frontend Editing
163 *
164 ****************************************************/
165 /**
166 * Returns TRUE if an edit-action is sent from the Admin Panel
167 *
168 * @return boolean
169 * @see index_ts.php
170 */
171 public function isEditAction() {
172 if (is_array($this->TSFE_EDIT)) {
173 if ($this->TSFE_EDIT['cancel']) {
174 unset($this->TSFE_EDIT['cmd']);
175 } else {
176 $cmd = (string) $this->TSFE_EDIT['cmd'];
177 if (($cmd != 'edit' || is_array($this->TSFE_EDIT['data']) && (($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update']) || $this->TSFE_EDIT['update_close'])) && $cmd != 'new') {
178 // $cmd can be a command like "hide" or "move". If $cmd is "edit" or "new" it's an indication to show the formfields. But if data is sent with update-flag then $cmd = edit is accepted because edit may be sent because of .keepGoing flag.
179 return TRUE;
180 }
181 }
182 }
183 return FALSE;
184 }
185
186 /**
187 * Returns TRUE if an edit form is shown on the page.
188 * Used from index_ts.php where a TRUE return-value will result in classes etc. being included.
189 *
190 * @return boolean
191 * @see index_ts.php
192 */
193 public function isEditFormShown() {
194 if (is_array($this->TSFE_EDIT)) {
195 $cmd = (string) $this->TSFE_EDIT['cmd'];
196 if ($cmd == 'edit' || $cmd == 'new') {
197 return TRUE;
198 }
199 }
200 }
201
202 /**
203 * Management of the on-page frontend editing forms and edit panels.
204 * Basically taking in the data and commands and passes them on to the proper classes as they should be.
205 *
206 * @return void
207 * @throws UnexpectedValueException if TSFE_EDIT[cmd] is not a valid command
208 * @see index_ts.php
209 */
210 public function editAction() {
211 // Commands
212 list($table, $uid) = explode(':', $this->TSFE_EDIT['record']);
213 $uid = intval($uid);
214 $cmd = $this->TSFE_EDIT['cmd'];
215 // Look for some TSFE_EDIT data that indicates we should save.
216 if ((($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update']) || $this->TSFE_EDIT['update_close']) && is_array($this->TSFE_EDIT['data'])) {
217 $cmd = 'save';
218 }
219 if ($cmd == 'save' || (($cmd && $table) && $uid) && isset($GLOBALS['TCA'][$table])) {
220 // Hook for defining custom editing actions. Naming is incorrect, but preserves compatibility.
221 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'])) {
222 $_params = array();
223 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'] as $_funcRef) {
224 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
225 }
226 }
227 // Perform the requested editing command.
228 $cmdAction = 'do' . ucwords($cmd);
229 if (is_callable(array($this, $cmdAction))) {
230 $this->{$cmdAction}($table, $uid);
231 } else {
232 throw new \UnexpectedValueException(('The specified frontend edit command (' . $cmd) . ') is not valid.', 1225818120);
233 }
234 }
235 }
236
237 /**
238 * Hides a specific record.
239 *
240 * @param string $table The table name for the record to hide.
241 * @param integer $uid The UID for the record to hide.
242 * @return void
243 */
244 public function doHide($table, $uid) {
245 $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
246 if ($hideField) {
247 $recData = array();
248 $recData[$table][$uid][$hideField] = 1;
249 $this->initializeTceMain();
250 $this->tce->start($recData, array());
251 $this->tce->process_datamap();
252 }
253 }
254
255 /**
256 * Unhides (shows) a specific record.
257 *
258 * @param string $table The table name for the record to unhide.
259 * @param integer $uid The UID for the record to unhide.
260 * @return void
261 */
262 public function doUnhide($table, $uid) {
263 $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
264 if ($hideField) {
265 $recData = array();
266 $recData[$table][$uid][$hideField] = 0;
267 $this->initializeTceMain();
268 $this->tce->start($recData, array());
269 $this->tce->process_datamap();
270 }
271 }
272
273 /**
274 * Moves a record up.
275 *
276 * @param string $table The table name for the record to move.
277 * @param integer $uid The UID for the record to hide.
278 * @return void
279 */
280 public function doUp($table, $uid) {
281 $this->move($table, $uid, 'up');
282 }
283
284 /**
285 * Moves a record down.
286 *
287 * @param string $table The table name for the record to move.
288 * @param integer $uid The UID for the record to move.
289 * @return void
290 */
291 public function doDown($table, $uid) {
292 $this->move($table, $uid, 'down');
293 }
294
295 /**
296 * Moves a record after a given element. Used for drag.
297 *
298 * @param string $table The table name for the record to move.
299 * @param integer $uid The UID for the record to move.
300 * @return void
301 */
302 public function doMoveAfter($table, $uid) {
303 $afterUID = $GLOBALS['BE_USER']->frontendEdit->TSFE_EDIT['moveAfter'];
304 $this->move($table, $uid, '', $afterUID);
305 }
306
307 /**
308 * Moves a record
309 *
310 * @param string $table The table name for the record to move.
311 * @param integer $uid The UID for the record to move.
312 * @param string $direction The direction to move, either 'up' or 'down'.
313 * @param integer $afterUID The UID of record to move after. This is specified for dragging only.
314 * @return void
315 */
316 protected function move($table, $uid, $direction = '', $afterUID = 0) {
317 $cmdData = array();
318 $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
319 if ($sortField) {
320 // Get self
321 $fields = array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', ($GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields'] . ',uid,pid,') . $sortField, TRUE));
322 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',', $fields), $table, 'uid=' . $uid);
323 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
324 // Record before or after
325 if ($GLOBALS['BE_USER']->adminPanel instanceof \TYPO3\CMS\Frontend\View\AdminPanelView && $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview')) {
326 $ignore = array('starttime' => 1, 'endtime' => 1, 'disabled' => 1, 'fe_group' => 1);
327 }
328 $copyAfterFieldsQuery = '';
329 if ($GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields']) {
330 $cAFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields'], TRUE);
331 foreach ($cAFields as $fieldName) {
332 $copyAfterFieldsQuery .= (((' AND ' . $fieldName) . '="') . $row[$fieldName]) . '"';
333 }
334 }
335 if (!empty($direction)) {
336 if ($direction == 'up') {
337 $operator = '<';
338 $order = 'DESC';
339 } else {
340 $operator = '>';
341 $order = 'ASC';
342 }
343 $sortCheck = ((' AND ' . $sortField) . $operator) . intval($row[$sortField]);
344 }
345 $GLOBALS['TYPO3_DB']->sql_free_result($res);
346 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid', $table, ((('pid=' . intval($row['pid'])) . $sortCheck) . $copyAfterFieldsQuery) . $GLOBALS['TSFE']->sys_page->enableFields($table, '', $ignore), '', ($sortField . ' ') . $order, '2');
347 if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
348 if ($afterUID) {
349 $cmdData[$table][$uid]['move'] = -$afterUID;
350 } elseif ($direction == 'down') {
351 $cmdData[$table][$uid]['move'] = -$row2['uid'];
352 } elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
353 // Must take the second record above...
354 $cmdData[$table][$uid]['move'] = -$row3['uid'];
355 } else {
356 // ... and if that does not exist, use pid
357 $cmdData[$table][$uid]['move'] = $row['pid'];
358 }
359 } elseif ($direction == 'up') {
360 $cmdData[$table][$uid]['move'] = $row['pid'];
361 }
362 $GLOBALS['TYPO3_DB']->sql_free_result($res);
363 }
364 if (!empty($cmdData)) {
365 $this->initializeTceMain();
366 $this->tce->start(array(), $cmdData);
367 $this->tce->process_cmdmap();
368 }
369 }
370 }
371
372 /**
373 * Deletes a specific record.
374 *
375 * @param string $table The table name for the record to delete.
376 * @param integer $uid The UID for the record to delete.
377 * @return void
378 */
379 public function doDelete($table, $uid) {
380 $cmdData[$table][$uid]['delete'] = 1;
381 if (count($cmdData)) {
382 $this->initializeTceMain();
383 $this->tce->start(array(), $cmdData);
384 $this->tce->process_cmdmap();
385 }
386 }
387
388 /**
389 * Saves a record based on its data array.
390 *
391 * @param string $table The table name for the record to save.
392 * @param integer $uid The UID for the record to save.
393 * @return void
394 */
395 public function doSave($table, $uid) {
396 $data = $this->TSFE_EDIT['data'];
397 if (!empty($data)) {
398 $this->initializeTceMain();
399 $this->tce->start($data, array());
400 $this->tce->process_uploads($_FILES);
401 $this->tce->process_datamap();
402 // Save the new UID back into TSFE_EDIT
403 $newUID = $this->tce->substNEWwithIDs['NEW'];
404 if ($newUID) {
405 $GLOBALS['BE_USER']->frontendEdit->TSFE_EDIT['newUID'] = $newUID;
406 }
407 }
408 }
409
410 /**
411 * Saves a record based on its data array and closes it.
412 *
413 * @param string $table The table name for the record to save.
414 * @param integer $uid The UID for the record to save.
415 * @return void
416 * @note This method is only a wrapper for doSave() but is needed so
417 */
418 public function doSaveAndClose($table, $uid) {
419 $this->doSave($table, $uid);
420 }
421
422 /**
423 * Stub for closing a record. No real functionality needed since content
424 * element rendering will take care of everything.
425 *
426 * @param string $table The table name for the record to close.
427 * @param integer $uid The UID for the record to close.
428 * @return void
429 */
430 public function doClose($table, $uid) {
431
432 }
433
434 /**
435 * Checks whether the user has access to edit the language for the
436 * requested record.
437 *
438 * @param string $table The name of the table.
439 * @param array $currentRecord The record.
440 * @return boolean
441 */
442 protected function allowedToEditLanguage($table, array $currentRecord) {
443 // If no access right to record languages, return immediately
444 if ($table === 'pages') {
445 $lang = $GLOBALS['TSFE']->sys_language_uid;
446 } elseif ($table === 'tt_content') {
447 $lang = $GLOBALS['TSFE']->sys_language_content;
448 } elseif ($GLOBALS['TCA'][$table]['ctrl']['languageField']) {
449 $lang = $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['languageField']];
450 } else {
451 $lang = -1;
452 }
453 if ($GLOBALS['BE_USER']->checkLanguageAccess($lang)) {
454 $languageAccess = TRUE;
455 } else {
456 $languageAccess = FALSE;
457 }
458 return $languageAccess;
459 }
460
461 /**
462 * Checks whether the user is allowed to edit the requested table.
463 *
464 * @param string $table The name of the table.
465 * @param array $dataArray The data array.
466 * @param array $conf The configuration array for the edit panel.
467 * @param boolean $checkEditAccessInternals Boolean indicating whether recordEditAccessInternals should not be checked. Defaults
468 * @return boolean
469 */
470 protected function allowedToEdit($table, array $dataArray, array $conf, $checkEditAccessInternals = TRUE) {
471 // Unless permissions specifically allow it, editing is not allowed.
472 $mayEdit = FALSE;
473 if ($checkEditAccessInternals) {
474 $editAccessInternals = $GLOBALS['BE_USER']->recordEditAccessInternals($table, $dataArray, FALSE, FALSE);
475 } else {
476 $editAccessInternals = TRUE;
477 }
478 if ($editAccessInternals) {
479 if ($table == 'pages') {
480 // 2 = permission to edit the page
481 if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess($dataArray, 2)) {
482 $mayEdit = TRUE;
483 }
484 } else {
485 // 16 = permission to edit content on the page
486 if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $dataArray['pid']), 16)) {
487 $mayEdit = TRUE;
488 }
489 }
490 if (!$conf['onlyCurrentPid'] || $dataArray['pid'] == $GLOBALS['TSFE']->id) {
491 // Permissions:
492 $types = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::strtolower($conf['allow']), 1);
493 $allow = array_flip($types);
494 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
495 if ($table == 'pages') {
496 $allow = $this->getAllowedEditActions($table, $conf, $dataArray['pid'], $allow);
497 // Can only display editbox if there are options in the menu
498 if (count($allow)) {
499 $mayEdit = TRUE;
500 }
501 } else {
502 $mayEdit = count($allow) && $perms & 16;
503 }
504 }
505 }
506 return $mayEdit;
507 }
508
509 /**
510 * Takes an array of generally allowed actions and filters that list based on page and content permissions.
511 *
512 * @param string $table The name of the table.
513 * @param array $conf The configuration array.
514 * @param integer $pid The PID where editing will occur.
515 * @param string $allow Comma-separated list of actions that are allowed in general.
516 * @return array
517 */
518 protected function getAllowedEditActions($table, array $conf, $pid, $allow = '') {
519 if (!$allow) {
520 $types = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::strtolower($conf['allow']), TRUE);
521 $allow = array_flip($types);
522 }
523 if (!$conf['onlyCurrentPid'] || $pid == $GLOBALS['TSFE']->id) {
524 // Permissions
525 $types = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::strtolower($conf['allow']), TRUE);
526 $allow = array_flip($types);
527 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
528 if ($table == 'pages') {
529 // Rootpage
530 if (count($GLOBALS['TSFE']->config['rootLine']) == 1) {
531 unset($allow['move']);
532 unset($allow['hide']);
533 unset($allow['delete']);
534 }
535 if (!($perms & 2)) {
536 unset($allow['edit']);
537 unset($allow['move']);
538 unset($allow['hide']);
539 }
540 if (!($perms & 4)) {
541 unset($allow['delete']);
542 }
543 if (!($perms & 8)) {
544 unset($allow['new']);
545 }
546 }
547 }
548 return $allow;
549 }
550
551 /**
552 * Adds any extra Javascript includes needed for Front-end editing
553 *
554 * @return string
555 */
556 public function getJavascriptIncludes() {
557 // No extra JS includes needed
558 return '';
559 }
560
561 /**
562 * Gets the hidden fields (array key=field name, value=field value) to be used in the edit panel for a particular content element.
563 * In the normal case, no hidden fields are needed but special controllers such as TemplaVoila need to track flexform pointers, etc.
564 *
565 * @param array $dataArray The data array for a specific content element.
566 * @return array
567 */
568 public function getHiddenFields(array $dataArray) {
569 // No special hidden fields needed.
570 return array();
571 }
572
573 /**
574 * Initializes t3lib_TCEmain since it is used on modification actions.
575 *
576 * @return void
577 */
578 protected function initializeTceMain() {
579 if (!isset($this->tce)) {
580 $this->tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandler\\DataHandler');
581 $this->tce->stripslashes_values = 0;
582 }
583 }
584
585 }
586
587
588 ?>