This project is read-only.

Adding Property of a Part into AutoRoute as Token

Topics: Customizing Orchard
Apr 2, 2012 at 7:49 AM

I will be having something like a tree view of regions of my site which are populated from one of my Content Part.

Every selectable node will have the attribute with the route value for that node. So I can merge the value with the title to get the route.  

 So once the user selects a region how can I add it to the Auto Route?

 I have tried setting the Token as {MySiteRegionPart.Region} ---this is the property to which the tree view sets the property to. but this does not work.

Any help much appreciated,


Apr 3, 2012 at 3:13 AM

Take a look at the Nwazet.Commerce module. It's exposing new tokens for part properties.

Apr 3, 2012 at 1:12 PM

Thanks that helped. I have created a new Token and using it that way. 

Feb 2, 2013 at 6:39 PM
How did you get this to work?

I have created a Token as per the Nwazet module, selected it for the Autoroute pattern of my content type but this never appears in the route. Fields properties are fine but its always seems to be properties of my part that never populate.

Kinds regards,

Feb 3, 2013 at 8:11 AM
Feb 3, 2013 at 9:39 AM
OK, thanks - I will have to think of something else.

In my particular instance I refactored the Orchard.Blogs module into a separate module. It is my implementation of the 'Blog' that the bug is connected with.

When testing this with the Orchard.Blogs module the same bug applies.
public void Describe(dynamic context)
            context.For("Blog", T("Blog"), T("Tokens for Blog"))
                .Token("Description", T("Description"), T("The Blog Description"));

        public void Evaluate(dynamic context)
                .Token("Description", (Func<IContent, object>)(content => content.As<BlogPart>().Description));
The route for the Blog content type: