silverstripe/silverstripe-framework — pull request #3274 by colymba (2014-07-08 11:41:08+00:00)
Title: API Custom admin URL

Pull request that follows the short discussion on the mailing list with @chillu here https://groups.google.com/forum/#!topic/silverstripe-dev/gGVRd0wS0U8

This PR goes along with the CMS one here https://github.com/silverstripe/silverstripe-cms/pull/1041
There is probably a few modules that will need updating, not sure which ones yet?

In short, this PR does:
- Use `AdminRootController` as the main class for admin URL configuration etc.
- `AdminRootController.url_base` is the main/only config for custom URL
- This is used during bootstrap to create a `Director.rules` config entry via `AdminRootController::set_admin_route()`
- Remove all other instances of `url_base` configs in other classes
- Makes utility functions and variables available globally:
- PHP `AdminRootController::adminURL()`
- SS `$AdminURL`
- JS `ss.config.adminURL`

TO me this seemed like the best approach and made things easier by only having to configure 1 thing once, even though the bootstrap call might not be that elegant? What do you think?

Note: one thing left are `SiteTree.DEFAULTHOMECONTENT` translations that have the admin URL hard-coded, but this might not be an issue?