Skip to content

Commit

Permalink
Minor: moved documentation concerning routing to a separate file rout…
Browse files Browse the repository at this point in the history
…ing.md
  • Loading branch information
Martimiz committed Dec 12, 2012
1 parent 05bcb5b commit 6b781c8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 53 deletions.
53 changes: 0 additions & 53 deletions docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,57 +82,4 @@ To create custom links to the homepage for your current locale, you can use the

$HomeLink

## Routing issue ##
The PrefixModelAsController needs to replace ModelAsController and RootURLController in
the YAML routes. For that to work it needs to come early in the route hierarchy or it will render urls like /dev and /admin unaccessible. This should work in _config/routes.yml:

---
Name: languageprefix
After: '#modelascontrollerroutes'
Before: '#coreroutes'
---
Director:
rules:
'': 'PrefixModelAsController'
'$Prefix/$URLSegment//$Action/$ID/$OtherID': 'PrefixModelAsController'

Unfortunately the current setup of routes.yml in both `framework` and `cms` doesn't allow this. So for the time being, existing rules for admin and other specific url's need to be added (again!) also:

---
Name: languageprefix
After: '#modelascontrollerroutes'
---
Director:
rules:
'': 'PrefixModelAsController'
'$Prefix/$URLSegment//$Action/$ID/$OtherID': 'PrefixModelAsController'
---
Name: lpcoreroutes
After: '#languageprefix'
---
Director:
rules:
'Security//$Action/$ID/$OtherID': 'Security'
'$Controller//$Action/$ID/$OtherID': '*'
'api/v1/live': 'VersionedRestfulServer'
'api/v1': 'RestfulServer'
'soap/v1': 'SOAPModelAccess'
'dev': 'DevelopmentAdmin'
'interactive': 'SapphireREPL'
---
Name: lpadminroutes
After: '#languageprefix'
---
Director:
rules:
'admin': 'AdminRootController'
'dev/buildcache/$Action': 'RebuildStaticCacheTask'
---
Name: lplegacycmsroutes
After: '#languageprefix'
---
Director:
rules:
'admin/cms': '->admin/pages'

## More information ##
54 changes: 54 additions & 0 deletions docs/en/routing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Routing #
The PrefixModelAsController needs to replace ModelAsController and RootURLController in
the YAML routes. For that to work it needs to come early in the route hierarchy or it will render urls like /dev and /admin unaccessible. This should work in _config/routes.yml:

---
Name: languageprefix
After: '#modelascontrollerroutes'
Before: '#coreroutes'
---
Director:
rules:
'': 'PrefixModelAsController'
'$Prefix/$URLSegment//$Action/$ID/$OtherID': 'PrefixModelAsController'

Unfortunately the current setup of routes.yml in both `framework` and `cms` doesn't allow this. So for the time being, existing rules for admin and other specific url's need to be added (again!) also:

---
Name: languageprefix
After: '#modelascontrollerroutes'
---
Director:
rules:
'': 'PrefixModelAsController'
'$Prefix/$URLSegment//$Action/$ID/$OtherID': 'PrefixModelAsController'
---
Name: lpcoreroutes
After: '#languageprefix'
---
Director:
rules:
'Security//$Action/$ID/$OtherID': 'Security'
'$Controller//$Action/$ID/$OtherID': '*'
'api/v1/live': 'VersionedRestfulServer'
'api/v1': 'RestfulServer'
'soap/v1': 'SOAPModelAccess'
'dev': 'DevelopmentAdmin'
'interactive': 'SapphireREPL'
---
Name: lpadminroutes
After: '#languageprefix'
---
Director:
rules:
'admin': 'AdminRootController'
'dev/buildcache/$Action': 'RebuildStaticCacheTask'
---
Name: lplegacycmsroutes
After: '#languageprefix'
---
Director:
rules:
'admin/cms': '->admin/pages'

This should generally work fine with any SilverStripe 3.x install. Please report problems with other (third party) modules as an issue on [GitHub](https://github.com/Martimiz/silverstripe-languageprefix/issues)

0 comments on commit 6b781c8

Please sign in to comment.