Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…ler.

Tests added.
  • Loading branch information...
commit ff74a599c6a875253069ec60294435c38bdcbe52 1 parent 5760f41
Mark Story markstory authored
4 cake/libs/controller/components/request_handler.php
View
@@ -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);
}
/**
6 cake/tests/cases/libs/controller/components/request_handler.test.php
View
@@ -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');
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.