0
votes

I have written a small extension that provide news for Backend User. Ist is just 2 Parts. One part showing the news for all BE User as a own Module, and the other part are create and edit functions provided by the TCA.

To work with the TCA forms and the default extbase getter, i need the correct storagePid. I can't set them via TypoScript, because I'm never in a page context.

My Idea was to use the Plugin settings with the file ext_conf_template.txt

# cat=persistence/enable; type=int; label=Storage pid
storagePid = 4457

settings

But how can I tell TYPO3 to look at this Settings?

At least Repository->findAll() must respect it

2

2 Answers

2
votes

Normally you would define this using TypoScript:

module.tx_yourextensionkey.persistence.storagePid = 123

Not being in a page context is not a blocker as long as you place the configuration on the first root TypoScript template (or include the TypoScript via other means which cause global inclusion not specific to any sys_template record or page tree location).

0
votes

Maybe not the best solution, but it works.

I have written my own function in the repository with the pid as parameter. I'm using the TYPO3 Query builder.
With $query->equals('pid', $pid); I get entries with my pid.
And with $query->getQuerySettings()->setRespectStoragePage(false); the default pid will be ignored.

And as the last step. My Controller gets the pid from the Settings, unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['my_extension']['storagePid']); an gives it to the function.