Christoffer Niska avatar Christoffer Niska committed a90b9d2

fixed an issue with displaying the BootBreadcrumbs homeLink

Comments (0)

Files changed (1)

widgets/BootBreadcrumbs.php

 
 	/**
 	 * Renders the content of the widget.
+	 * @throws CException
 	 */
 	public function run()
 	{
+		if (empty($this->links))
+			return;
+
 		$links = array();
 
 		if (!isset($this->homeLink))
-			$this->homeLink = array('label'=>Yii::t('bootstrap', 'Home'), 'url'=>Yii::app()->homeUrl);
+		{
+			$content = CHtml::link(Yii::t('bootstrap', 'Home'), Yii::app()->homeUrl);
+			$links[] = $this->renderItem($content);
+		}
+		else if ($this->homeLink !== false)
+			$links[] = $this->renderItem($this->homeLink);
 
-		if ($this->homeLink !== false)
-		{
-			if (is_array($this->homeLink))
-				$this->homeLink = CHtml::link($this->homeLink['label'], $this->homeLink['url']);
-			
-			$links[] = $this->renderItem($this->homeLink, Yii::app()->request->requestUri === Yii::app()->homeUrl);
-		}
-		
-		foreach ($this->links as $label=>$url)
+		foreach ($this->links as $label => $url)
 		{
 			if (is_string($label) || is_array($url))
 			{
-				$label = $this->encodeLabel ? CHtml::encode($label) : $label;
-				$content = CHtml::link($label, $url);
+				$content = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
 				$links[] = $this->renderItem($content);
 			}
 			else
 	 * @param boolean $active whether the item is active.
 	 * @return string the markup.
 	 */
-	protected function renderItem($content, $active=false)
+	protected function renderItem($content, $active = false)
 	{
 		$separator = !$active ? '<span class="divider">'.$this->separator.'</span>' : '';
 		
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.