Commit 1bdb4695 by Crisu83

fixed an issue with displaying the BootBreadcrumbs homeLink

parent 56610a1c
...@@ -33,28 +33,28 @@ class BootBreadcrumbs extends CBreadcrumbs ...@@ -33,28 +33,28 @@ class BootBreadcrumbs extends CBreadcrumbs
/** /**
* Renders the content of the widget. * Renders the content of the widget.
* @throws CException
*/ */
public function run() public function run()
{ {
if (empty($this->links))
return;
$links = array(); $links = array();
if (!isset($this->homeLink)) if (!isset($this->homeLink))
$this->homeLink = array('label'=>Yii::t('bootstrap', 'Home'), 'url'=>Yii::app()->homeUrl);
if ($this->homeLink !== false)
{ {
if (is_array($this->homeLink)) $content = CHtml::link(Yii::t('bootstrap', 'Home'), Yii::app()->homeUrl);
$this->homeLink = CHtml::link($this->homeLink['label'], $this->homeLink['url']); $links[] = $this->renderItem($content);
$links[] = $this->renderItem($this->homeLink, Yii::app()->request->requestUri === Yii::app()->homeUrl);
} }
else if ($this->homeLink !== false)
foreach ($this->links as $label=>$url) $links[] = $this->renderItem($this->homeLink);
foreach ($this->links as $label => $url)
{ {
if (is_string($label) || is_array($url)) if (is_string($label) || is_array($url))
{ {
$label = $this->encodeLabel ? CHtml::encode($label) : $label; $content = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
$content = CHtml::link($label, $url);
$links[] = $this->renderItem($content); $links[] = $this->renderItem($content);
} }
else else
...@@ -72,7 +72,7 @@ class BootBreadcrumbs extends CBreadcrumbs ...@@ -72,7 +72,7 @@ class BootBreadcrumbs extends CBreadcrumbs
* @param boolean $active whether the item is active. * @param boolean $active whether the item is active.
* @return string the markup. * @return string the markup.
*/ */
protected function renderItem($content, $active=false) protected function renderItem($content, $active = false)
{ {
$separator = !$active ? '<span class="divider">'.$this->separator.'</span>' : ''; $separator = !$active ? '<span class="divider">'.$this->separator.'</span>' : '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment