I have a use case where I need to determine if a particular template on the Content Delivery side has the output format of REL
.
The reason is because I'm trying to determine whether to use the ComponentPresentationFactory
or the ComponentPresentationAssember
for my evil deeds.
On the CM we set the Output Format on a Component Template as follows:
On the CD side, it is not obvious how to leverage this parameter.
The CD API's ComponentPresentationFactory
has a method GetComponentPresentationWithOutputFormat
, e.g.:
var cp = cpFactory.GetComponentPresentationWithOutputFormat(tcmUri.ItemId, "REL");
This tells me that the information about a CT's output format is stored on the CD side.
(As a side thought/question, I may have multiple CTs for a given component that are REL. So what which one would the above method return, the highest priority one, or the first one it finds?)
Another supporting argument that the OutputFormat
exists on the CD side is that the Tridion.ContentDelivery.Meta.ITemplateMeta
interface has a OutputFormat
property as per the documentation. But I can't, for the life of me, figure out how to get an instance of ITemplateMeta
based on a template ID.
I am trying to avoid having to publish any XML or JSON files from the CM with a listing of REL templates because that just seems hacky.
Can anyone please shed some light on how to get the OutputFormat on the CD side?