3.6.2 Configuring Components
Many of the core components require configuration. Some examples of components requiring configuration are Auth, Cookie and Email. Configuration for these components, and components in general is usually done in your Controller's beforeFilter() method.
function beforeFilter() {
$this->Auth->authorize = 'controller';
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Cookie->name = 'CookieMonster';
}
function beforeFilter() {$this->Auth->authorize = 'controller';$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');$this->Cookie->name = 'CookieMonster';}
Would be an example of configuring component variables in your controller's beforeFilter()
It's possible, however, that a component requires certain configuration options to be set before the controller's beforeFilter is run. To this end, some components allow configuration options be set in the $components array.
var $components = array('DebugKit.toolbar' => array('panels' => array('history', 'session'));
var $components = array('DebugKit.toolbar' => array('panels' => array('history', 'session'));
Consult the relevant documentation to determine what configuration options each component provides.
The components can have the beforeRender and beforeRedirect callbacks which are triggered before your page is rendered and before a redirect respectively.
You can disable the callbacks triggering by setting the enabled property of a component to false.
