‪TYPO3CMS  11.5
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 {
38  public function ‪addData(array $result)
39  {
40  if ($result['command'] !== 'edit' || !empty($result['databaseRow'])) {
41  return $result;
42  }
43 
44  $databaseRow = $this->‪getRecordFromDatabase($result['tableName'], $result['vanillaUid']);
45  if (!array_key_exists('pid', $databaseRow)) {
46  throw new \UnexpectedValueException(
47  'Parent record does not have a pid field',
48  1437663061
49  );
50  }
51  if (BackendUtility::isTableWorkspaceEnabled($result['tableName'])
52  && isset($databaseRow['t3ver_state'])
53  && ‪VersionState::cast($databaseRow['t3ver_state'])->equals(‪VersionState::DELETE_PLACEHOLDER)
54  ) {
55  // Workspace delete placeholder records (t3ver_state = 2) should never be edited. This is a fallback
56  // to suppress editing in case something still links to FormEngine edit of such a record.
58  'Record with uid "' . $databaseRow['uid'] . '" from table "' . $result['tableName'] . '" is'
59  . ' a workspace delete placeholder record which can not be edited.',
60  1608658396,
61  $result['tableName'],
62  (int)$databaseRow['uid']
63  );
64  }
65 
66  $result['databaseRow'] = $databaseRow;
67 
68  return $result;
69  }
70 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEditRow
Definition: DatabaseEditRow.php:28
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEditRow\addData
‪array addData(array $result)
Definition: DatabaseEditRow.php:38
‪TYPO3\CMS\Backend\Form\FormDataProvider\AbstractDatabaseRecordProvider
Definition: AbstractDatabaseRecordProvider.php:30
‪TYPO3\CMS\Core\Versioning\VersionState\DELETE_PLACEHOLDER
‪const DELETE_PLACEHOLDER
Definition: VersionState.php:61
‪TYPO3\CMS\Backend\Form\Exception\DatabaseRecordWorkspaceDeletePlaceholderException
Definition: DatabaseRecordWorkspaceDeletePlaceholderException.php:26
‪TYPO3\CMS\Core\Type\Enumeration\cast
‪static static cast($value)
Definition: Enumeration.php:186
‪TYPO3\CMS\Backend\Form\FormDataProvider\AbstractDatabaseRecordProvider\getRecordFromDatabase
‪array getRecordFromDatabase($tableName, $uid)
Definition: AbstractDatabaseRecordProvider.php:43
‪TYPO3\CMS\Backend\Form\FormDataProvider
Definition: AbstractDatabaseRecordProvider.php:16
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:23
‪TYPO3\CMS\Core\Versioning\VersionState
Definition: VersionState.php:24
‪TYPO3\CMS\Backend\Form\Exception\DatabaseRecordException
Definition: DatabaseRecordException.php:24