Skip to content

Commit 63d2469

Browse files
committed
remove some trash
1 parent de8c8fd commit 63d2469

File tree

1 file changed

+0
-141
lines changed

1 file changed

+0
-141
lines changed

Classes/XClass/PageRepository.php

-141
Original file line numberDiff line numberDiff line change
@@ -183,145 +183,4 @@ public function getRecordOverlay($table, $row, $sys_language_content = null, $OL
183183

184184
return $row;
185185
}
186-
public function notgetRecordOverlay($table, $row, $sys_language_content = null, $OLmode = '')
187-
{
188-
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'] ?? [] as $className) {
189-
$hookObject = GeneralUtility::makeInstance($className);
190-
if (!$hookObject instanceof PageRepositoryGetRecordOverlayHookInterface) {
191-
throw new \UnexpectedValueException($className . ' must implement interface ' . PageRepositoryGetRecordOverlayHookInterface::class, 1269881658);
192-
}
193-
$hookObject->getRecordOverlay_preProcess($table, $row, $sys_language_content, $OLmode, $this);
194-
}
195-
196-
$tableControl = $GLOBALS['TCA'][$table]['ctrl'] ?? [];
197-
$languageAspect = $this->context->getAspect('language');
198-
if (!empty($tableControl['languageField'])
199-
// Return record for ALL languages untouched
200-
// @todo: Fix call stack to prevent this situation in the first place
201-
&& (int)$row[$tableControl['languageField']] !== -1
202-
&& !empty($tableControl['transOrigPointerField'])
203-
&& $row['uid'] > 0
204-
&& ($row['pid'] > 0 || in_array($tableControl['rootLevel'] ?? false, [true, 1, -1], true))) {
205-
// Will try to overlay a record only if the sys_language_content value is larger than zero.
206-
if ($sys_language_content > 0) {
207-
// Must be default language, otherwise no overlaying
208-
if ((int)$row[$tableControl['languageField']] === 0) {
209-
// Select overlay record:
210-
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
211-
->getQueryBuilderForTable($table);
212-
$queryBuilder->setRestrictions(
213-
GeneralUtility::makeInstance(FrontendRestrictionContainer::class, $this->context)
214-
);
215-
if ($this->versioningWorkspaceId > 0) {
216-
// If not in live workspace, remove query based "enable fields" checks, it will be done in versionOL()
217-
// @see functional workspace test createLocalizedNotHiddenWorkspaceContentHiddenInLive()
218-
$queryBuilder->getRestrictions()->removeByType(HiddenRestriction::class);
219-
$queryBuilder->getRestrictions()->removeByType(StartTimeRestriction::class);
220-
$queryBuilder->getRestrictions()->removeByType(EndTimeRestriction::class);
221-
// We remove the FrontendWorkspaceRestriction in this case, because we need to get the LIVE record
222-
// of the language record before doing the version overlay of the language again. WorkspaceRestriction
223-
// does this for us, PLUS we need to ensure to get a possible LIVE record first (that's why
224-
// the "orderBy" query is there, so the LIVE record is found first), as there might only be a
225-
// versioned record (e.g. new version) or both (common for modifying, moving etc).
226-
if ($this->hasTableWorkspaceSupport($table)) {
227-
$queryBuilder->getRestrictions()->removeByType(FrontendWorkspaceRestriction::class);
228-
$queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->versioningWorkspaceId));
229-
$queryBuilder->orderBy('t3ver_wsid', 'ASC');
230-
}
231-
}
232-
233-
$pid = $row['pid'];
234-
// When inside a workspace, the already versioned $row of the default language is coming in
235-
// For moved versioned records, the PID MIGHT be different. However, the idea of this function is
236-
// to get the language overlay of the LIVE default record, and afterwards get the versioned record
237-
// the found (live) language record again, see the versionOL() call a few lines below.
238-
// This means, we need to modify the $pid value for moved records, as they might be on a different
239-
// page and use the PID of the LIVE version.
240-
if (isset($row['_ORIG_pid']) && $this->hasTableWorkspaceSupport($table) && VersionState::cast($row['t3ver_state'] ?? 0)->equals(VersionState::MOVE_POINTER)) {
241-
$pid = $row['_ORIG_pid'];
242-
}
243-
244-
245-
// MST: get fallback chain
246-
$fallbackChain = $languageAspect->get('fallbackChain');
247-
// MST: append fallbackchain to requested language
248-
print_r($sys_language_content);
249-
print_r($fallbackChain);
250-
$fallbackChain = [$sys_language_content, ...$fallbackChain];
251-
print_r($fallbackChain); exit;
252-
// MST: load content by fallbackChain
253-
foreach ($fallbackChain as $sys_language_content) {
254-
if ($sys_language_content != intval($sys_language_content)) {
255-
break;
256-
}
257-
258-
$olrow = $queryBuilder->select('*')
259-
->from($table)
260-
->where(
261-
$queryBuilder->expr()->eq(
262-
'pid',
263-
$queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)
264-
),
265-
$queryBuilder->expr()->eq(
266-
$tableControl['languageField'],
267-
$queryBuilder->createNamedParameter($sys_language_content, \PDO::PARAM_INT)
268-
),
269-
$queryBuilder->expr()->eq(
270-
$tableControl['transOrigPointerField'],
271-
$queryBuilder->createNamedParameter($row['uid'], \PDO::PARAM_INT)
272-
)
273-
)
274-
->setMaxResults(1)
275-
->executeQuery()
276-
->fetchAssociative();
277-
// MST: exit if somthing is found
278-
if (is_array($olrow)) {
279-
break;
280-
}
281-
}
282-
283-
$this->versionOL($table, $olrow);
284-
// Merge record content by traversing all fields:
285-
if (is_array($olrow)) {
286-
if (isset($olrow['_ORIG_uid'])) {
287-
$row['_ORIG_uid'] = $olrow['_ORIG_uid'];
288-
}
289-
if (isset($olrow['_ORIG_pid'])) {
290-
$row['_ORIG_pid'] = $olrow['_ORIG_pid'];
291-
}
292-
foreach ($row as $fN => $fV) {
293-
if ($fN !== 'uid' && $fN !== 'pid' && array_key_exists($fN, $olrow)) {
294-
$row[$fN] = $olrow[$fN];
295-
} elseif ($fN === 'uid') {
296-
$row['_LOCALIZED_UID'] = $olrow['uid'];
297-
}
298-
}
299-
} elseif ($OLmode === 'hideNonTranslated' && (int)$row[$tableControl['languageField']] === 0) {
300-
// Unset, if non-translated records should be hidden. ONLY done if the source
301-
// record really is default language and not [All] in which case it is allowed.
302-
$row = null;
303-
}
304-
} elseif ($sys_language_content != $row[$tableControl['languageField']]) {
305-
$row = null;
306-
}
307-
} else {
308-
// When default language is displayed, we never want to return a record carrying
309-
// another language!
310-
if ($row[$tableControl['languageField']] > 0) {
311-
$row = null;
312-
}
313-
}
314-
}
315-
316-
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'] ?? [] as $className) {
317-
$hookObject = GeneralUtility::makeInstance($className);
318-
if (!$hookObject instanceof PageRepositoryGetRecordOverlayHookInterface) {
319-
throw new \UnexpectedValueException($className . ' must implement interface ' . PageRepositoryGetRecordOverlayHookInterface::class, 1269881659);
320-
}
321-
$hookObject->getRecordOverlay_postProcess($table, $row, $sys_language_content, $OLmode, $this);
322-
}
323-
324-
return $row;
325-
}
326-
327186
}

0 commit comments

Comments
 (0)