‪TYPO3CMS  9.5
DatabasePageLanguageOverlayRows.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 
27 {
34  public function ‪addData(array $result)
35  {
36  if ($result['effectivePid'] === 0) {
37  // No overlays for records on pid 0 and not for new pages below root
38  return $result;
39  }
40 
41  $result['pageLanguageOverlayRows'] = $this->‪getDatabaseRows((int)$result['effectivePid']);
42 
43  return $result;
44  }
45 
52  protected function ‪getDatabaseRows(int $pid): array
53  {
54  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
55  ->getQueryBuilderForTable('pages');
56  $queryBuilder->getRestrictions()
57  ->removeAll()
58  ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
59  ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
60 
61  $rows = $queryBuilder->select('*')
62  ->from('pages')
63  ->where($queryBuilder->expr()->eq(
64  ‪$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField'],
65  $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)
66  ))
67  ->execute()
68  ->fetchAll();
69 
70  return $rows;
71  }
72 }
‪TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction
Definition: BackendWorkspaceRestriction.php:28
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabasePageLanguageOverlayRows\addData
‪array addData(array $result)
Definition: DatabasePageLanguageOverlayRows.php:34
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabasePageLanguageOverlayRows
Definition: DatabasePageLanguageOverlayRows.php:27
‪TYPO3\CMS\Backend\Form\FormDataProvider
Definition: AbstractDatabaseRecordProvider.php:2
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:22
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
Definition: DeletedRestriction.php:26
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:44
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabasePageLanguageOverlayRows\getDatabaseRows
‪array getDatabaseRows(int $pid)
Definition: DatabasePageLanguageOverlayRows.php:52