Skip to content

Commit

Permalink
Allow the passing parameter escape of the getCrumbList method and ref…
Browse files Browse the repository at this point in the history
…lecting that into the outputted link too
  • Loading branch information
lucasff committed Mar 3, 2014
1 parent c635565 commit 7096495
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/Cake/View/Helper/HtmlHelper.php
Expand Up @@ -713,14 +713,15 @@ public function getCrumbs($separator = '»', $startText = false) {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper
*/
public function getCrumbList($options = array(), $startText = false) {
$defaults = array('firstClass' => 'first', 'lastClass' => 'last', 'separator' => '');
$defaults = array('firstClass' => 'first', 'lastClass' => 'last', 'separator' => '', 'escape' => true);
$options = array_merge($defaults, (array)$options);
$firstClass = $options['firstClass'];
$lastClass = $options['lastClass'];
$separator = $options['separator'];
$escape = $options['escape'];
unset($options['firstClass'], $options['lastClass'], $options['separator']);

$crumbs = $this->_prepareCrumbs($startText);
$crumbs = $this->_prepareCrumbs($startText, $escape);
if (empty($crumbs)) {
return null;
}
Expand Down Expand Up @@ -754,7 +755,7 @@ public function getCrumbList($options = array(), $startText = false) {
* @param string $startText Text to prepend
* @return array Crumb list including startText (if provided)
*/
protected function _prepareCrumbs($startText) {
protected function _prepareCrumbs($startText, $escape = true) {
$crumbs = $this->_crumbs;
if ($startText) {
if (!is_array($startText)) {
Expand All @@ -766,7 +767,7 @@ protected function _prepareCrumbs($startText) {
$startText += array('url' => '/', 'text' => __d('cake', 'Home'));
list($url, $text) = array($startText['url'], $startText['text']);
unset($startText['url'], $startText['text']);
array_unshift($crumbs, array($text, $url, $startText));
array_unshift($crumbs, array($text, $url, $startText + array('escape' => $escape));
}
return $crumbs;
}
Expand Down

0 comments on commit 7096495

Please sign in to comment.