‪TYPO3CMS  ‪main
TcaInlineIsOnSymmetricSide.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 
20 
28 {
35  public function ‪addData(array $result)
36  {
37  if (!$result['isInlineChild']) {
38  return $result;
39  }
40 
41  $result['isOnSymmetricSide'] = ‪MathUtility::canBeInterpretedAsInteger($result['databaseRow']['uid'])
42  && ($result['inlineParentConfig']['symmetric_field'] ?? false)
43  // non-strict comparison by intention
44  && ($result['inlineParentUid'] == $result['databaseRow'][$result['inlineParentConfig']['symmetric_field']][0]
45  || (is_array($result['databaseRow'][$result['inlineParentConfig']['symmetric_field']][0])
46  && $result['inlineParentUid'] == $result['databaseRow'][$result['inlineParentConfig']['symmetric_field']][0]['uid']));
47 
48  return $result;
49  }
50 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\TcaInlineIsOnSymmetricSide\addData
‪array addData(array $result)
Definition: TcaInlineIsOnSymmetricSide.php:35
‪TYPO3\CMS\Backend\Form\FormDataProvider\TcaInlineIsOnSymmetricSide
Definition: TcaInlineIsOnSymmetricSide.php:28
‪TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger
‪static bool canBeInterpretedAsInteger(mixed $var)
Definition: MathUtility.php:69
‪TYPO3\CMS\Backend\Form\FormDataProvider
Definition: AbstractDatabaseRecordProvider.php:16
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:23
‪TYPO3\CMS\Core\Utility\MathUtility
Definition: MathUtility.php:24