Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding ability to set configuration from initialize() for RequestHand…

…ler.

Tests added.
  • Loading branch information...
commit ff74a599c6a875253069ec60294435c38bdcbe52 1 parent 5760f41
@markstory markstory authored
View
4 cake/libs/controller/components/request_handler.php
@@ -165,14 +165,16 @@ function __construct() {
* as the first item.
*
* @param object $controller A reference to the controller
+ * @param array $settings Array of settings to _set().
* @return void
* @see Router::parseExtensions()
* @access public
*/
- function initialize(&$controller) {
+ function initialize(&$controller, $settings = array()) {
if (isset($controller->params['url']['ext'])) {
$this->ext = $controller->params['url']['ext'];
}
+ $this->_set($settings);
}
/**
View
6 cake/tests/cases/libs/controller/components/request_handler.test.php
@@ -186,6 +186,12 @@ function testInitializeCallback() {
$this->Controller->params['url']['ext'] = 'rss';
$this->RequestHandler->initialize($this->Controller);
$this->assertEqual($this->RequestHandler->ext, 'rss');
+
+ $settings = array(
+ 'ajaxLayout' => 'test_ajax'
+ );
+ $this->RequestHandler->initialize($this->Controller, $settings);
+ $this->assertEqual($this->RequestHandler->ajaxLayout, 'test_ajax');
}
/**

0 comments on commit ff74a59

Please sign in to comment.
Something went wrong with that request. Please try again.