‪TYPO3CMS  ‪main
DatabaseEditRow.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
21 use TYPO3\CMS\Backend\Utility\BackendUtility;
23 
28 {
37  public function ‪addData(array $result)
38  {
39  if ($result['command'] !== 'edit' || !empty($result['databaseRow'])) {
40  return $result;
41  }
42 
43  $databaseRow = $this->‪getRecordFromDatabase($result['tableName'], $result['vanillaUid']);
44  if (!array_key_exists('pid', $databaseRow)) {
45  throw new \UnexpectedValueException(
46  'Parent record does not have a pid field',
47  1437663061
48  );
49  }
50  if (BackendUtility::isTableWorkspaceEnabled($result['tableName'])
51  && VersionState::tryFrom($databaseRow['t3ver_state'] ?? 0) === VersionState::DELETE_PLACEHOLDER
52  ) {
53  // Workspace delete placeholder records (t3ver_state = 2) should never be edited. This is a fallback
54  // to suppress editing in case something still links to FormEngine edit of such a record.
56  'Record with uid "' . $databaseRow['uid'] . '" from table "' . $result['tableName'] . '" is'
57  . ' a workspace delete placeholder record which can not be edited.',
58  1608658396,
59  $result['tableName'],
60  (int)$databaseRow['uid']
61  );
62  }
63 
64  $result['databaseRow'] = $databaseRow;
65 
66  return $result;
67  }
68 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEditRow
Definition: DatabaseEditRow.php:28
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEditRow\addData
‪array addData(array $result)
Definition: DatabaseEditRow.php:37
‪TYPO3\CMS\Backend\Form\FormDataProvider\AbstractDatabaseRecordProvider
Definition: AbstractDatabaseRecordProvider.php:31
‪TYPO3\CMS\Core\Versioning\VersionState
‪VersionState
Definition: VersionState.php:22
‪TYPO3\CMS\Backend\Form\Exception\DatabaseRecordWorkspaceDeletePlaceholderException
Definition: DatabaseRecordWorkspaceDeletePlaceholderException.php:26
‪TYPO3\CMS\Backend\Form\FormDataProvider\AbstractDatabaseRecordProvider\getRecordFromDatabase
‪array getRecordFromDatabase($tableName, $uid)
Definition: AbstractDatabaseRecordProvider.php:44
‪TYPO3\CMS\Backend\Form\FormDataProvider
Definition: AbstractDatabaseRecordProvider.php:16
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:23
‪TYPO3\CMS\Backend\Form\Exception\DatabaseRecordException
Definition: DatabaseRecordException.php:24