FluidTYPO3 / vhs

TYPO3 extension VHS: Fluid ViewHelpers
https://fluidtypo3.org
Other
189 stars 228 forks source link

v:page.rootline : Exception when page doesn't exist #1688

Closed sdelcroix closed 2 years ago

sdelcroix commented 3 years ago

Hi,

we have custom fluid styled contents which contain link field (t3://) which allows editors to select a page, and In backend preview templates, we use v:page.rootline to render a rootline to this page.

Sometimes editors delete the page but don't update the content element.

Since vhs 6.0.4 (that uses RootlineUtility class), TYPO3 raises an exception if the page is deleted.

(1/1) #1343589451 TYPO3\CMS\Core\Exception\Page\PageNotFoundException Could not fetch page data for uid 3070.

bj0hn commented 2 years ago

I can confirm, have the same problem.

This bug should be fixed. My workaround for now:

<f:if condition="{f:uri.page(pageUid: document.pid)}">

    {v:page.rootline(pageUid: document.pid)}

</f:if>
NamelessCoder commented 2 years ago

This should perhaps be reported to https://forge.typo3.org - if this is still failing, the likely cause is that the TYPO3 Context (the class, not the Application Context) is being misconfigured or is intentionally configured to still enforce the deleted = 0 clause on queries that select the root line; when you are in a BE-user situation. My two cents is that it is probably intentional even in BE - previewing/rootlining a hidden page is a perfectly valid use case, but a deleted page certainly should not be possible and should yield an error anywhere except perhaps in the Recycler (technically, it no longer exists).

VHS will not attempt to fix this issue by creating a custom Context that shows you deleted pages, or by implementing a custom RootLineUtility capable of skipping/ignoring deleted pages based on context. I'd suggest using the workaround by @bj0hn since your use case is a bit special.