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

[BUG] indexing news content_elements fails / local tsfe not passed down #3358

Open
akiessling opened this issue Oct 8, 2022 · 2 comments
Open

Comments

@akiessling
Copy link
Contributor

Describe the bug
I'm trying to index news records that have content elements attached to it. Since i need the "fully rendered" content and not just single fields, i wanted to use RECORDS for the content field. But this fails since RECORDS does not pass down the TSFE when it calls itself recursive and $GLOBALS['TSFE'] is empty --> nothing gets rendered.

Since this was already tackled in #3244 / #3239 and https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073 i'm not sure if i am missing something.

It seems to work with patching the RecordsContentObject like this so it passes down the TSFE to the new ContentObjectRenderer

https://github.com/TYPO3/typo3/blob/6962acffc9b7169f84838f77bc47ac312663e510/typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php#L91

if ($itemArrayCount > 0) {
    $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class, $this->getTypoScriptFrontendController());
    $cObj->setParent($this->cObj->data, $this->cObj->currentRecord);

Are there any known side effects to this? I'll add a core bugreport if you don't have any objections

To Reproduce
Steps to reproduce the behavior:

  1. Add a news indexer with content set to this
content = SOLR_CONTENT
content {
    cObject = COA
    cObject {
        10 = TEXT
        10 {
            field = bodytext
            noTrimWrap = || |
        }

        20 = CONTENT
        20 {
            table = tt_content
            select {
                pidInList.field = pid
                orderBy = sorting
                languageField = sys_language_uid
                includeRecordsWithoutDefaultTranslation = 1
                where = {#tt_content.tx_news_related_news} = ###NEWS_UID###
                markers {
                    NEWS_UID.field = uid
                }
            }
        }
    }
}
  1. index the news record
  2. check the indexed solr document if the content field actually contains the content from the attached content elements

Expected behavior
The content of the related content elements should get indexed

Used versions (please complete the following information):

  • TYPO3 Version: 11.5.16
  • EXT:solr Version: 11.5.0
  • PHP Version: 8.1
@akiessling akiessling changed the title [BUG] indexing news content_elements fails / config for records are not passed down [BUG] indexing news content_elements fails / local tsfe not passed down Oct 8, 2022
@dkd-kaehm
Copy link
Collaborator

@akiessling
Thanks for reporting.
The suggested code in core should work.
Please link the core issue and change-set here.

@akiessling
Copy link
Contributor Author

https://forge.typo3.org/issues/98622
https://review.typo3.org/c/Packages/TYPO3.CMS/+/76121

ContentContentObject also needs the same patch, otherwise running the indexer from the scheduler complained about a missing tmpl from the TSFE

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

2 participants