‪TYPO3CMS  11.5
Typo3QuerySettings.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 
18 use Psr\Http\Message\ServerRequestInterface;
24 
29 {
32 
38  protected ‪$respectStoragePage = true;
39 
45  protected ‪$storagePageIds = [];
46 
54  protected ‪$ignoreEnableFields = false;
55 
62  protected ‪$enableFieldsToBeIgnored = [];
63 
69  protected ‪$includeDeleted = false;
70 
76  protected ‪$respectSysLanguage = true;
77 
83  protected ‪$languageOverlayMode = true;
84 
90  protected ‪$languageUid = 0;
91 
92  public function ‪__construct(
95  ) {
96  // QuerySettings should always keep its own Context, as they can differ
97  // Currently this is only used for reading, but might be improved in the future
98  $this->context = clone ‪$context;
99  $this->configurationManager = ‪$configurationManager;
100  if ((‪$GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface
101  && ‪ApplicationType::fromRequest(‪$GLOBALS['TYPO3_REQUEST'])->isBackend()
102  && $this->configurationManager->isFeatureEnabled('ignoreAllEnableFieldsInBe')) {
103  $this->‪setIgnoreEnableFields(true);
104  }
106  $languageAspect = $this->context->getAspect('language');
107  $this->‪setLanguageUid($languageAspect->getContentId());
108  $this->‪setLanguageOverlayMode(false);
109 
110  if ((‪$GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface
111  && ‪ApplicationType::fromRequest(‪$GLOBALS['TYPO3_REQUEST'])->isFrontend()
112  ) {
113  $overlayMode = $languageAspect->getLegacyOverlayType() === 'hideNonTranslated' ? 'hideNonTranslated' : (bool)$languageAspect->getLegacyOverlayType();
114  $this->‪setLanguageOverlayMode($overlayMode);
115  } elseif ((int)GeneralUtility::_GP('L')) {
116  // Set language from 'L' parameter
117  $this->‪setLanguageUid((int)GeneralUtility::_GP('L'));
118  }
119  }
120 
128  {
129  $this->respectStoragePage = ‪$respectStoragePage;
130  return $this;
131  }
132 
138  public function ‪getRespectStoragePage()
139  {
141  }
142 
149  public function ‪setStoragePageIds(array ‪$storagePageIds)
150  {
151  $this->storagePageIds = ‪$storagePageIds;
152  return $this;
153  }
154 
160  public function ‪getStoragePageIds()
161  {
163  }
164 
170  {
171  $this->respectSysLanguage = ‪$respectSysLanguage;
172  return $this;
173  }
174 
178  public function ‪getRespectSysLanguage()
179  {
181  }
182 
187  public function ‪setLanguageOverlayMode(‪$languageOverlayMode = false)
188  {
189  $this->languageOverlayMode = ‪$languageOverlayMode;
190  return $this;
191  }
192 
196  public function ‪getLanguageOverlayMode()
197  {
199  }
200 
208  public function ‪setLanguageMode($languageMode = '')
209  {
210  trigger_error(
211  __METHOD__ . ' does not have any functionality any more, stop calling it.',
212  E_USER_DEPRECATED
213  );
214  return $this;
215  }
216 
223  public function ‪getLanguageMode()
224  {
225  trigger_error(
226  __METHOD__ . ' does not have any functionality any more, stop calling it.',
227  E_USER_DEPRECATED
228  );
229  return null;
230  }
231 
236  public function ‪setLanguageUid(‪$languageUid)
237  {
238  $this->languageUid = ‪$languageUid;
239  return $this;
240  }
241 
245  public function ‪getLanguageUid()
246  {
247  return ‪$this->languageUid;
248  }
249 
260  {
261  $this->ignoreEnableFields = ‪$ignoreEnableFields;
262  return $this;
263  }
264 
274  public function ‪getIgnoreEnableFields()
275  {
277  }
278 
289  {
290  $this->enableFieldsToBeIgnored = ‪$enableFieldsToBeIgnored;
291  return $this;
292  }
293 
301  public function ‪getEnableFieldsToBeIgnored()
302  {
304  }
305 
313  {
314  $this->includeDeleted = ‪$includeDeleted;
315  return $this;
316  }
317 
323  public function ‪getIncludeDeleted()
324  {
326  }
327 }
‪TYPO3\CMS\Core\Http\ApplicationType\fromRequest
‪static static fromRequest(ServerRequestInterface $request)
Definition: ApplicationType.php:62
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\$configurationManager
‪ConfigurationManagerInterface $configurationManager
Definition: Typo3QuerySettings.php:30
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\getIgnoreEnableFields
‪bool getIgnoreEnableFields()
Definition: Typo3QuerySettings.php:266
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\getIncludeDeleted
‪bool getIncludeDeleted()
Definition: Typo3QuerySettings.php:315
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\getRespectStoragePage
‪bool getRespectStoragePage()
Definition: Typo3QuerySettings.php:130
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\$languageUid
‪int $languageUid
Definition: Typo3QuerySettings.php:82
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\$respectStoragePage
‪bool $respectStoragePage
Definition: Typo3QuerySettings.php:37
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\setLanguageOverlayMode
‪QuerySettingsInterface setLanguageOverlayMode($languageOverlayMode=false)
Definition: Typo3QuerySettings.php:179
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\$languageOverlayMode
‪bool $languageOverlayMode
Definition: Typo3QuerySettings.php:76
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\getLanguageOverlayMode
‪mixed getLanguageOverlayMode()
Definition: Typo3QuerySettings.php:188
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:28
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\getEnableFieldsToBeIgnored
‪array getEnableFieldsToBeIgnored()
Definition: Typo3QuerySettings.php:293
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\setIncludeDeleted
‪QuerySettingsInterface setIncludeDeleted($includeDeleted)
Definition: Typo3QuerySettings.php:304
‪TYPO3\CMS\Core\Http\ApplicationType
Definition: ApplicationType.php:52
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:53
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\getStoragePageIds
‪array getStoragePageIds()
Definition: Typo3QuerySettings.php:152
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\setRespectSysLanguage
‪QuerySettingsInterface setRespectSysLanguage($respectSysLanguage)
Definition: Typo3QuerySettings.php:161
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\$ignoreEnableFields
‪bool $ignoreEnableFields
Definition: Typo3QuerySettings.php:51
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\$respectSysLanguage
‪bool $respectSysLanguage
Definition: Typo3QuerySettings.php:70
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\$includeDeleted
‪bool $includeDeleted
Definition: Typo3QuerySettings.php:64
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\$enableFieldsToBeIgnored
‪array $enableFieldsToBeIgnored
Definition: Typo3QuerySettings.php:58
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\getLanguageMode
‪string getLanguageMode()
Definition: Typo3QuerySettings.php:215
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\$context
‪Context $context
Definition: Typo3QuerySettings.php:31
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\setStoragePageIds
‪QuerySettingsInterface setStoragePageIds(array $storagePageIds)
Definition: Typo3QuerySettings.php:141
‪TYPO3\CMS\Core\Context\LanguageAspect
Definition: LanguageAspect.php:57
‪TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
Definition: QuerySettingsInterface.php:22
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\$storagePageIds
‪array $storagePageIds
Definition: Typo3QuerySettings.php:43
‪TYPO3\CMS\Extbase\Persistence\Generic
Definition: Backend.php:16
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\getLanguageUid
‪int getLanguageUid()
Definition: Typo3QuerySettings.php:237
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\getRespectSysLanguage
‪bool getRespectSysLanguage()
Definition: Typo3QuerySettings.php:170
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\__construct
‪__construct(Context $context, ConfigurationManagerInterface $configurationManager)
Definition: Typo3QuerySettings.php:84
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\setEnableFieldsToBeIgnored
‪QuerySettingsInterface setEnableFieldsToBeIgnored($enableFieldsToBeIgnored)
Definition: Typo3QuerySettings.php:280
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\setRespectStoragePage
‪QuerySettingsInterface setRespectStoragePage($respectStoragePage)
Definition: Typo3QuerySettings.php:119
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\setIgnoreEnableFields
‪QuerySettingsInterface setIgnoreEnableFields($ignoreEnableFields)
Definition: Typo3QuerySettings.php:251
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\setLanguageMode
‪QuerySettingsInterface setLanguageMode($languageMode='')
Definition: Typo3QuerySettings.php:200
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings
Definition: Typo3QuerySettings.php:29
‪TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings\setLanguageUid
‪QuerySettingsInterface setLanguageUid($languageUid)
Definition: Typo3QuerySettings.php:228