fnagel / t3extblog

A record based blog extension for TYPO3 CMS. Easy to use and packed with features (incl. comments, subscriptions for comments and posts, Wordpress like subscription manager, reasonable email sending in FE and BE, GDPR ready, BE modules, Dashboard widgets, RSS, Sitemap, ...). Flexible and powerful!
http://typo3.org/extensions/repository/view/t3extblog
GNU General Public License v2.0
32 stars 18 forks source link

Update vhs (VHS: Fluid Viewhelpers) to v 7.0.0 breaks t3extblog v 6.2.1 Detail-View #265

Closed hgra60 closed 3 months ago

hgra60 commented 9 months ago

The function "renderRecord" is updated in vhs

an old version is taken into "/t3extblog/Classes/ViewHelpers/Frontend/RenderContentViewHelper.php":

/**
 * This function renders a raw record into the corresponding
 * element by typoscript RENDER function.
 *
 * Taken from EXT:vhs/Classes/ViewHelpers/Content/AbstractContentViewHelper.php
 *
 * @param int    $uid
 * @param string $table
 *
 * @return string
 */
protected function renderRecord($uid, $table)
{ ...

but not updated accordingly.

Thx for your attention to this

Helmut Grabendörfer, visionbites

fnagel commented 9 months ago

Hi Helmut,

can you please describe the error and post the complete stack trace? Not sure what "breaks detail view" means. As there is no dependency of EXT:vhs I'm unsure how an update of VHS should break T3Extblog at all.

In newer version of the extension, I replaced the VH with core functionality: https://github.com/fnagel/t3extblog/commit/adefdb968a5831f82c4e5373778c74750b91dfec

You may want to try that and give feedback please. But any PR for the 6.x branch in order fix the VH is fine too!

hgra60 commented 8 months ago

Hi Felix, we had the error after updating VHS form v6 to v7 the error is that the the links in the list do not work any more, blog article is not displayed

We think that this is caused by an VHS function that is copied into your file /t3extblog/Classes/ViewHelpers/Frontend/RenderContentViewHelper.php

vhs function from VHS v6, that might not work anymore with v7

/**
 * This function renders a raw record into the corresponding
 * element by typoscript RENDER function.
 *
 * Taken from EXT:vhs/Classes/ViewHelpers/Content/AbstractContentViewHelper.php
 *
 * @param int    $uid
 * @param string $table
 *
 * @return string
 */
protected function renderRecord($uid, $table)
{
    if (0 < GeneralUtility::getTsFe()->recordRegister[$table.':'.$uid]) {
        return '';
    }

    $configuration = [
        'tables' => $table,
        'source' => $uid,
        'dontCheckPid' => 1,
    ];

    $parent = GeneralUtility::getTsFe()->currentRecord;
    if (!empty($parent)) {
        ++GeneralUtility::getTsFe()->recordRegister[$parent];
    }

    $html = $this->getContentObjectRenderer()->cObjGetSingle('RECORDS', $configuration);

    GeneralUtility::getTsFe()->currentRecord = $parent;
    if (!empty($parent)) {
        --GeneralUtility::getTsFe()->recordRegister[$parent];
    }

    return $html;
}

This function changed in VHS v7 :

/**
 * This function renders a raw tt_content record into the corresponding
 * element by typoscript RENDER function. We keep track of already
 * rendered records to avoid rendering the same record twice inside the
 * same nested stack of content elements.
 */
protected static function renderRecord(array $row): ?string
{
    if (0 < ($GLOBALS['TSFE']->recordRegister['tt_content:' . $row['uid']] ?? 0)) {
        return null;
    }
    $conf = [
        'tables' => 'tt_content',
        'source' => $row['uid'],
        'dontCheckPid' => 1
    ];
    $parent = $GLOBALS['TSFE']->currentRecord;
    // If the currentRecord is set, we register, that this record has invoked this function.
    // It's should not be allowed to do this again then!!
    if (!empty($parent)) {
        if (isset($GLOBALS['TSFE']->recordRegister[$parent])) {
            ++$GLOBALS['TSFE']->recordRegister[$parent];
        } else {
            $GLOBALS['TSFE']->recordRegister[$parent] = 1;
        }
    }
    $html = $GLOBALS['TSFE']->cObj->cObjGetSingle('RECORDS', $conf);

    $GLOBALS['TSFE']->currentRecord = $parent;
    if (!empty($parent)) {
        --$GLOBALS['TSFE']->recordRegister[$parent];
    }
    return $html;
}

Thx for your attention to this

fnagel commented 7 months ago

Thanks for the error report. A little strange that there is no error but this part of code works with the register and TS rendering, so you never know...

Can you explain how to reproduce this issue? Using TYPO3 10, VHS 7.x and T3Extblog 6.x as far as I understood. Then I need to configure the blog system and do what exactly with VHS to reproduce the issue? Or is installing both extensions enough?

In newer version of the extension, I replaced the VH with core functionality: https://github.com/fnagel/t3extblog/commit/adefdb968a5831f82c4e5373778c74750b91dfec

Did you try to use this change? Does it help?

Any reason why you do not update to v11 and T3Extblog 7.x? To be honest, I'm not sure if I will find the time to debug this in TYPO3 v10 when I really need to fix the extension to work with TYPO3 v12.

fnagel commented 5 months ago

Any feedback on this issue?

fnagel commented 4 months ago

Can you please check if EXT:vhs v7.0.2 fixes this? There have been quite a few bugs in v7.0.0, see here:

Workaround for one of them: 12b247a9f2c8bdd40378965a8070e6e9dbf906e2 https://github.com/FluidTYPO3/vhs/blob/development/Documentation/Changelog/7.0.1.md https://github.com/FluidTYPO3/vhs/blob/development/Documentation/Changelog/7.0.2.md

fnagel commented 3 months ago

Closed as no feedback was given. Please reopen or create a new ticket if needed.