Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"v:content.resources.fal" in TYPO3 v11 in a flux template "Preview" section causes "No aspect named "frontend.preview" found." Errror #1796

Open
ako-3004 opened this issue Aug 1, 2022 · 2 comments

Comments

@ako-3004
Copy link

ako-3004 commented Aug 1, 2022

Affects TYPO3 v11.5.13 with flux (9.6.1) and vhs (6.1.2)
it is not possible to use "v:content.resources.fal" in a flux content template in the "preview" section:

Flux Content Template:

<f:section name="Preview">
	<f:debug>{v:content.resources.fal(table:'tt_content', field: 'settings.teaser.image', uid: '594')}</f:debug>
</f:section>

causes error:

(1/1) #1527777868 TYPO3\CMS\Core\Context\Exception\AspectNotFoundException
No aspect named "frontend.preview" found.

So, missing frontend.preview aspect in /var/www/mbcs/public/typo3conf/ext/vhs/Classes/ViewHelpers/Resource/Record/AbstractRecordResourceViewHelper.php line 173

lines 171 to 176:

if (class_exists('\\TYPO3\\CMS\\Frontend\\Aspect\\PreviewAspect')) {
    //TYPO3 version >= 10
    $fePreview = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('frontend.preview', 'isPreview');
} else {
    $fePreview = (bool)(isset($GLOBALS['TSFE']) && $GLOBALS['TSFE']->fePreview);
}

guess "frontend.preview" is for real frontend preview in TYPO3 backend, but not for the preview section. Aspect "frontend.preview" does not exist in TYPO3\CMS\Core\Context\Context

this may be the solution:

if (class_exists('\\TYPO3\\CMS\\Frontend\\Aspect\\PreviewAspect')) {
    //TYPO3 version >= 10
    if (GeneralUtility::makeInstance(Context::class)->hasAspect('frontend.preview')) {
        $fePreview = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('frontend.preview', 'isPreview');	
    } else {
        $fePreview = false;
    }
} else {
    $fePreview = (bool)(isset($GLOBALS['TSFE']) && $GLOBALS['TSFE']->fePreview);
}
@shroom24
Copy link

replacing

{v:content.resources.fal(table: 'tt_content', field: 'images', record.uid: uid)}

with

{v:content.resources.fal(table: 'tt_content', field: 'images', record: record)}

solved the error for me

@OliverRWeiss
Copy link

This problem also arises with {v:resource.record()} when used in TYPO3 backend.
@ako-3004 's solution fixes the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants