Skip to content

Commit 45b2552

Browse files
committed
feat: Allow submission of storagePids
1 parent 17c5740 commit 45b2552

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Classes/Service/VariablesService.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class VariablesService
2121
protected Set $cacheTags;
2222
protected array $usedMarkerKeys = [];
2323

24+
protected array $variablesStoragePids = [];
25+
2426
protected ?ExtensionConfiguration $extensionConfiguration = null;
2527
protected ?TypoScriptFrontendController $typoScriptFrontendController = null;
2628
protected ?MarkerCollection $markerCollection = null;
@@ -35,6 +37,7 @@ public function __construct()
3537
public function initialize(
3638
ExtensionConfiguration $extensionConfiguration = null,
3739
TypoScriptFrontendController $typoScriptFrontendController = null,
40+
$variablesStoragePids = [],
3841
): void {
3942
if (!$typoScriptFrontendController instanceof \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController) {
4043
$typoScriptFrontendController = $this->getTypoScriptFrontendController();
@@ -44,6 +47,11 @@ public function initialize(
4447
$extensionConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class);
4548
}
4649

50+
// Define the location of the variable records (useful in APIs)
51+
if (count($variablesStoragePids) > 0) {
52+
$this->variablesStoragePids = $variablesStoragePids;
53+
}
54+
4755
$this->extensionConfiguration = $extensionConfiguration;
4856
$this->typoScriptFrontendController = $typoScriptFrontendController;
4957
$this->markerCollection = $this->getMarkers();
@@ -140,6 +148,8 @@ protected function getMarkers(): MarkerCollection
140148
$pids[] = (int)$GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.typoscript')->getSetupArray()['plugin.']['tx_variables.']['persistence.']['storagePid'];
141149
}
142150

151+
$pids = array_unique(array_merge($pids, $this->variablesStoragePids));
152+
143153
$table = 'tx_variables_marker';
144154
$rows = $this->typoScriptFrontendController->cObj->getRecords(
145155
$table,

0 commit comments

Comments
 (0)