I want to setup HtmlHelper::link() method so the default options array have escape = false.
How can I achieve this without changing the core class?
OBS: I al
another good practice that I think cakephp should implement that you also can implement is a simple Factory Pattern Helper. The following should be consider just psuedo not real code.
$this->Factory->getHelper('Html')->link();
instead of
$this->Html->link();
take the following for example
class FactoryHelper extends Helper {
public function getHelper($name) {
if(Configure::read('Overrides.{$name}')) {
return $this->{Configure::read('Overrides.{$name}')};
}
return (isset($this->{$name})?$this->{$name}:false);
}
}
//Bootstrap is where you will set all your overrides
Configure::write('Overrides',array(
'Html'=>'NewHtml'
));
//so now when you want to override any helper you can
So now in the bootstrap that you set to override Html Helper. Throughout your entire site, your new 'NewHtml' helper will be called instead of the traditional helper.