This project is read-only.

Importing Queries and Projections without referencing List or Query IDs

Topics: Core, General
Sep 30, 2014 at 9:48 PM

I am creating an Orchard CMS Recipe Generator. It has gone well and I it is mostly working except for one thing.

I noticed that when you EXPORT an Orchard Site the Filter and Layout nodes have a STATE property that, for some types of filters or layouts, includes a hard-coded Id.

This is a chicken an egg problem if I want to generate a recipe that imports queries.

In the case of the filter node, I want to create a filter by ContentType (no problem) AND by container/list. The STATE field in that case has a value something like this...
<Form><Description></Description><ListId>25</ListId></Form> The problem is that the list/container is being created at the same time (in the same recipe) as the Query so at run-time the Id is not known. Everywhere else Orchard uses Identities that are basically strings and that are known at runtime.

For the filter, I have a work around.

But the layout is a completely different story. The layout seems to need a reference to the QueryId itself. It has a state field that looks like this....
<Form><QueryId>48</QueryId><Category>Html</Category><Type>List</Type><Description></Description><Display>0</Display><DisplayType>Summary</DisplayType><Order>unordered</Order><ListId></ListId><ListClass></ListClass><ItemClass></ItemClass></Form> The Query ID is hard-coded. (I have not tried leaving it off but I will try that next.)

Is there ANY way around these issues?