‪TYPO3CMS  10.4
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 
22 
27 {
36  public function ‪addData(array $result)
37  {
38  if ($result['command'] !== 'edit' || !empty($result['databaseRow'])) {
39  return $result;
40  }
41 
42  $databaseRow = $this->‪getRecordFromDatabase($result['tableName'], $result['vanillaUid']);
43  if (!array_key_exists('pid', $databaseRow)) {
44  throw new \UnexpectedValueException(
45  'Parent record does not have a pid field',
46  1437663061
47  );
48  }
49  if (‪BackendUtility::isTableWorkspaceEnabled($result['tableName'])
50  && isset($databaseRow['t3ver_state'])
51  && ‪VersionState::cast($databaseRow['t3ver_state'])->equals(‪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  // Warning: By reference! In case the record is in a workspace, the -1 in pid will be
65  // changed to the real pid of the life record here.
66  ‪BackendUtility::fixVersioningPid($result['tableName'], $databaseRow);
67  $result['databaseRow'] = $databaseRow;
68 
69  return $result;
70  }
71 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEditRow
Definition: DatabaseEditRow.php:27
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEditRow\addData
‪array addData(array $result)
Definition: DatabaseEditRow.php:36
‪TYPO3\CMS\Backend\Form\FormDataProvider\AbstractDatabaseRecordProvider
Definition: AbstractDatabaseRecordProvider.php:29
‪TYPO3\CMS\Core\Versioning\VersionState\DELETE_PLACEHOLDER
‪const DELETE_PLACEHOLDER
Definition: VersionState.php:55
‪TYPO3\CMS\Backend\Form\Exception\DatabaseRecordWorkspaceDeletePlaceholderException
Definition: DatabaseRecordWorkspaceDeletePlaceholderException.php:26
‪TYPO3\CMS\Backend\Utility\BackendUtility\isTableWorkspaceEnabled
‪static bool isTableWorkspaceEnabled($table)
Definition: BackendUtility.php:4021
‪TYPO3\CMS\Core\Type\Enumeration\cast
‪static static cast($value)
Definition: Enumeration.php:186
‪TYPO3\CMS\Backend\Utility\BackendUtility\fixVersioningPid
‪static fixVersioningPid($table, &$rr, $ignoreWorkspaceMatch=false)
Definition: BackendUtility.php:3511
‪TYPO3\CMS\Backend\Form\FormDataProvider\AbstractDatabaseRecordProvider\getRecordFromDatabase
‪array getRecordFromDatabase($tableName, $uid)
Definition: AbstractDatabaseRecordProvider.php:42
‪TYPO3\CMS\Backend\Form\FormDataProvider
Definition: AbstractDatabaseRecordProvider.php:16
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:23
‪TYPO3\CMS\Core\Versioning\VersionState
Definition: VersionState.php:24