Created
June 16, 2012 03:24
-
-
Save sessa/2939793 to your computer and use it in GitHub Desktop.
CakePHP Active Link Helper
This file contains 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
class MyHtmlHelper extends HtmlHelper { | |
public function activeLink($title, $url = null, $options = array(), $confirmMessage = false) { | |
if ($this->request->here == $url) { | |
if(isset($options['class'])) { | |
$options['class'] .= ' active'; | |
} else { | |
$options['class'] = 'active'; | |
} | |
} | |
return $this->link($title, $url, $options, $confirmMessage); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You will want to alias this in your AppController - 'Html' => array('className' => 'MyHtml')