‪TYPO3CMS  9.5
SiteResolving.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
21 
30 {
37  public function ‪addData(array $result): array
38  {
39  if ($result['defaultLanguagePageRow']['t3ver_oid'] ?? null) {
40  $pageIdDefaultLanguage = (int)$result['defaultLanguagePageRow']['t3ver_oid'];
41  } elseif ($result['defaultLanguagePageRow']['uid'] ?? null) {
42  $pageIdDefaultLanguage = (int)$result['defaultLanguagePageRow']['uid'];
43  } elseif (array_key_exists('tableName', $result) && $result['tableName'] === 'pages') {
44  if (!empty($result['databaseRow']['t3ver_oid'])) {
45  $pageIdDefaultLanguage = $result['databaseRow']['t3ver_oid'];
46  } else {
47  $pageIdDefaultLanguage = $result['databaseRow']['uid'] ?? $result['effectivePid'];
48  }
49  } else {
50  $pageIdDefaultLanguage = $result['effectivePid'];
51  }
52  $result['site'] = GeneralUtility::makeInstance(SiteMatcher::class)->matchByPageId((int)$pageIdDefaultLanguage);
53  return $result;
54  }
55 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\SiteResolving
Definition: SiteResolving.php:30
‪TYPO3\CMS\Backend\Form\FormDataProvider\SiteResolving\addData
‪array addData(array $result)
Definition: SiteResolving.php:37
‪TYPO3\CMS\Backend\Form\FormDataProvider
Definition: AbstractDatabaseRecordProvider.php:2
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:22
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Routing\SiteMatcher
Definition: SiteMatcher.php:53