This project is read-only.

Content token in query used in projection widget not possible

Topics: General
Nov 14, 2013 at 12:45 PM
I've created a query which needs to use a field I added to my page content type: "Branch" (see also this topic) . I would like to use this query in a projection widget, but it seems like it's not working. My query is "Service.Branch is equal to '{Content.Fields.Page.Branch}'". I've debugged the ContentTokens class and it seems that forContent.Data is null, but I have no idea why or how to make this work.
Nov 15, 2013 at 5:12 PM
I've mislead you in the original discussion, sorry for that. Here is an explanation (in the comments) for why it doesn't work:

So, you can either create a filter implementation that creates the HQL clause for the content field (you can find hinds in and if you search for IFilterProvider in the source code). This is what I *guessed* when I wrote "In any case you will need to provide a filter implementation to use Region name of Service content type in your query.", but for the wrong content type, you will need to provide this for Page, not service. I think this is too much work for your requirements, and that part of Orchard is still a cold dark place for me, as you have probably figured out.

*Or* you can use the request URL as I suggested in the original post, with "ends with" operator.

You might want to look at this post about URL rewrites that would allow you to pass Branch name in /Services/Branch as a query parameter to he underlying controllers as in /Services?branch=Branch, so that you would not have to create all the pages, just one with a single query widget.