How to make extbase extension recognize storage page from plugin?

Urs picture Urs · Jan 15, 2014 · Viewed 12.7k times · Source

In an extbase extension built with extension builder on TYPO3 6.1.7, I haven't set any storagePid via Typoscript.

But I have set the "Record Storage Page" in the plugin:

enter image description here

I would expect that it would now only fetch records from this page. But it doesn't, it just returns all items from that table.

How do I make the extension recognize the setting from the plugin? Or (if it's supposed to do that out of the box) how do I find out why it doesn't?

Answer

thismaechler picture thismaechler · Apr 8, 2016

I did a lot of research when my extension's frontend plugin (TYPO3 7.6.4) refused to use the 'pages' field of the plugin ("Record Storage Page"), so I would like to share my findings:

My extension's name is 'tx_dhsnews', my plugin's name is 'infobox'

  1. setRespectStoragePage must be set to true (default): $query->setRespectStoragePage(TRUE)

  2. In the typoscript-setup, the plugin-specific storagePid plugin.tx_dhsnews_infobox.persistence.storagePid MUST NOT be present at all! Not event with an empty value! Else the 'pages'-field will not be respected!

That's all. The Extensions Builder just created a typoscript-setup with the storagePid for the specific plugin 'infobox' set to nothing. That resulted in the plugin not respecting the 'pages' - field.

It's no problem to set the storagePid on extension-level (e.g. 'tx_dhsnews..persistence.storagePid'), the value will be merged with the value(s) given in 'pages' ("Record Storage Page"), but as soon the plugin-specific tx_[extension]_[plugin].persistence.storagePid exists in the typoscript, it will overrule everything else!

Hope this will help somebody to save some time + nerves