When writing a deployer extension (for the first time!), is it possible to load the file contents of a component presentation?
So my instructions contain the following:
<Section Type="ComponentPresentations" Name="ComponentPresentations"> <ComponentPresentation Name="tcm_70-18142_tcm_70-17937-32" TemplateId="tcm:70-17937-32" ComponentId="tcm:70-18142"/> </Section>
I have logic already to find the component presentation I need using
getFileItems() but this only returns an iterator of ComponentPresentationKeys.
I'm not sure exactly how to use a
ComponentPresentationKey to load my component presentation so I can get to the rendered output?
When you need to access published content as I do, is it actually better to override an existing module?
If I extended
ComponentPresentationDeploy I think the
processComponentPresentation method would give me access to published contents, but I need to know the schema of the component in order to trigger my custom business logic, but this isn't available if you override in this way.
As my output is just Xml, I could add schema info in here, but I'd have to load every presentation as an Xml doc and check the schema - when I know some can be ignored, hence my attempt to do this by not overriding an existing module.
I've had more success moving to overriding ComponentPresentationDeploy (as Jon describes below) as this way the component presentation package file is provided as part of the overidden method signature, removing the need for me to load this file manually (I suspect then that there is no API method for doing this - you'd have to do it manually and understand the directory conventions).
I've adjusted my determining logic from checking schema Ids to checking template Ids as this was more straight forward and I don't think at this point in the process trying to determine schema is the right thing to do as I'm interacting with rendered content.