TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
DatabasePageLanguageOverlayRows.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Form\FormDataProvider;
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_language_overlay');
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_language_overlay')
63  ->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)))
64  ->execute()
65  ->fetchAll();
66 
67  return $rows;
68  }
69 }
static makeInstance($className,...$constructorArguments)