...
Known runtime contexts are:
Runtime Context | Setting Name | Configured From |
---|---|---|
Front-End | Is Front-End? | /index.php |
Theme Name | URL | |
Mod-Rewrite Urls | System Setting | |
Admin Console | Is Admin Console? | /admin/index.php |
Typical URL examples:
URL | Where | ||
---|---|---|---|
| to the "platform/login/register " template in "advanced " theme on Front-End when Mod-Rewrite is disabled | ||
| to the "platform/login/register " template in "advanced " theme on Front-End when Mod-Rewrite is enabled | ||
| to the "languages/phrase_list " template in Admin Console |
If a need arises to build url to Admin Console from Front-End or vice versa then this can be done, to the certain extent, using this code:
...
Code Block |
---|
// Use Admin context. $backup = $this->Application->applyRuntimeContext(new AdminRuntimeContext()); // do something $this->Application->applyRuntimeContext($backup); // Use Front-End context from current theme. $backup = $this->Application->applyRuntimeContext(new FrontEndRuntimeContext()); // do something $this->Application->applyRuntimeContext($backup); // Use Front-End context from primary theme. $backup = $this->Application->applyRuntimeContext(new FrontEndRuntimeContext('default')); // do something $this->Application->applyRuntimeContext($backup); // Use Front-End context from given theme. $backup = $this->Application->applyRuntimeContext(new FrontEndRuntimeContext(5)); // do something $this->Application->applyRuntimeContext($backup); |
Plan:
- create "kApplication::themePath" public property and use it instead of THEMES_PATH constant (keep constant for BC)
- create "kApplication::modRewrite" public property and use it instead of MOD_REWRITE constant (keep constant for BC)
- add "FrontEndRuntimeContext" class, that will be able to calculate values for "isAdmin", "themePath" and "modRewrite" application properties for a given theme
- add "AdminRuntimeContext" class, that will be able to calculate values for "isAdmin", "themePath" and "modRewrite" application properties for Admin Console
- change "kUrlManager::LoadStructureTemplateMapping" method to allow to be called several times in a row
- extract configuration code of "TemplatesCache" class, that depends on values changed by runtime context into separate "configure" method
- create "kApplication::applyRuntimeContext(AbstractRuntimeContext $runtime_context)" method, that will:
- set values of kApplication properties from matching properties of runtime context
- initialize "theme.current" object (front-end only)
- set "m_theme" request variable
- call "TemplatesCache::configure" method
- call "kUrlManager::LoadStructureTemplateMapping" method
- return runtime context that was used prior to this method was called