We are trying to extend the FSPageDAO in a storage extension and in the
create(CharacterData page, String relativePath) method, we would like to get a list of all the components placed on that page.
How can we do this?
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It only takes a minute to sign up.Sign up to join this community
You can always try to access the package as described here using a deployer extension. Or if you want to stick to the Storage extension, you might be able to re-use the
Utilities class provided in the link above and then use its getComponentPresentationsDocument method (or another method in such class) to access the package files and/or contents.
I asked this question over an year back and per my knowledge, there is no straight-forward way to achieve this.
The data the deployer passes to your method (CharacterData page) is actually your rendered Component Presentation (the ouput that your PT will generate for your page), so if you want just a list of component presentations you could generate some XML in your page template :
<componentpresentations> <componentpresentation> <component id="tcmid of component" /> <componenttemplate id="tcmid of componenttemplate" /> </componentpresentation> </componentpresentations>
If you want to have BOTH the normal output of the page and the list of components then there is no list of components available to your code via the CharacterData interface; you will have to push a data fragment into your output as a comment (either client or server side) and read that from your code.