Created
March 18, 2012 17:38
-
-
Save mariuskubilius/2078339 to your computer and use it in GitHub Desktop.
LI3 Change layout depending whether admin continuation route is used or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use lithium\action\Dispatcher; | |
//Allow admin continuation routes to be made. | |
Dispatcher::config( | |
array( | |
'rules' => array( | |
'admin' => array('action' => 'admin_{:action}') | |
) | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Apply filter to render in admin layout when in admin section. | |
*/ | |
use lithium\net\http\Media; | |
Media::applyFilter('render', function($self, $params, $chain){ | |
$request = $params['options']['request']; | |
$admin = isset($request->params['admin']) ? $request->params['admin'] : false; | |
if($admin){ | |
$params['options']['layout'] = 'admin'; | |
} | |
return $chain->next($self, $params, $chain); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Enabble admin routes | |
*/ | |
Router::connect('/admin/{:args}', array('admin' => true), array('continue' => true)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment