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

Record Storage Page is ignored with multiple blog plugins on the same page #292

Open
derBoogie opened this issue Sep 19, 2023 · 4 comments · Fixed by visualmovement/blog#1 · May be fixed by #297
Open

Record Storage Page is ignored with multiple blog plugins on the same page #292

derBoogie opened this issue Sep 19, 2023 · 4 comments · Fixed by visualmovement/blog#1 · May be fixed by #297

Comments

@derBoogie
Copy link

I have two blog plugins on one page with different record storage page set.
The second plugin incorrectly shows the blog entries of the first plugin.

In search of the cause, I set a debug output in PostRepository in function getStoragePidsFromTypoScript.
$this->settings['persistence']['storagePid'] provides in both cases incorrectly the record storage page uid of the first plugin on the page.
The record storage page uid of the second plugin is ignored.

  • TYPO3 v11.5.30
  • Blog v12.0.2
@peterkraume
Copy link

@derBoogie Same issue here. Did you find a solution yet?

@peterkraume
Copy link

My szenario:
2 plugins on the same page with different storagePids set in each plugin.

I tried to analyze the bug with Xdebug. When I put a breakpoint in PostRepository.php to public function initializeObject() and protected function getPidsForConstraints() Xdebug stops at initializeObject() only once while getPidsForConstraints() is called twice.

@julianhofmann
Copy link

An Extbase repository is a singleton, i.e. only one object of that class exists.
EXT:blog reads the settings into a class variable in initializeObject(). However, the settings are dependent on the context when they are read, i.e. they can be dependent on the content element.
The second content element uses the repository again - only it already exists as an object, which is why it can be used immediately and is not initialized (i.e. the settings are not read in again).

Based on v11, it seems to work if you change getStoragePidsFromTypoScript() back to:

protected function getStoragePidsFromTypoScript(): array
{
    $configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class);
    $settings = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);

    return GeneralUtility::intExplode(',', $settings['persistence']['storagePid']);
}

@derBoogie
Copy link
Author

@peterkraume thanks for your debugging.
@julianhofmann thanks for your analysis. Your solution works!

peterkraume added a commit to peterkraume/blog that referenced this issue Nov 8, 2023
This patch fixes a problem with ignored storagePid if there are multiple
blog post plugins on the same page. Only the storagePid setting from the
first plugin was evaluated.

Fixes TYPO3GmbH#292
@peterkraume peterkraume linked a pull request Nov 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants