Is it possible to use more complicated layer url rule matching syntax? I want to be able to choose the layer to display based on a more regex type rule that matches the rules I have set up in my custom routing for my module.
I would like to be able to acheive something along the lines of:
url('~/my-{\w*}/something/{\w*}')
It’s not available ootb, but could be pretty easy to implement yourself in a custom module (if you don’t want to alter the core code).
It can be implemented as a slight modification to existing
Orchard.Widgets.RuleEngine.UrlRuleProvider, so regexes would be also taken into account.Just create an implementation of IRuleProvider, name your function as eg. ‘urlregex’ (so it wouldn’t collide with the existing ‘url’, processed by UrlRuleProvider) and do all the processing stuff inside
Process(RuleContext ruleContext)method. It’s a very simple class to implement and would involve just a few lines of code – take a look at the default url rule provider I mentioned at the beginning.