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