Skip to content

Commit

Permalink
changed way how to set current node (BC break)
Browse files Browse the repository at this point in the history
  • Loading branch information
janmarek committed Feb 15, 2012
1 parent f46499c commit 3291d6e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Navigation extends Control
* Set node as current
* @param NavigationNode $node
*/
public function setCurrent(NavigationNode $node)
public function setCurrentNode(NavigationNode $node)
{
if (isset($this->current)) {
$this->current->isCurrent = false;
Expand All @@ -51,7 +51,7 @@ public function add($label, $url)
* Setup homepage
* @param string $label
* @param string $url
* @return Navigation
* @return NavigationNode
*/
public function setupHomepage($label, $url)
{
Expand Down
13 changes: 10 additions & 3 deletions NavigationNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ public function add($label, $url) {

/**
* Set node as current
* @param NavigationNode $node
* @param bool $current
* @return \Navigation\NavigationNode
*/
public function setCurrent(NavigationNode $node)
public function setCurrent($current)
{
$this->getParent()->setCurrent($node);
$this->isCurrent = $current;

if ($current) {
$this->lookup('Navigation\Navigation')->setCurrentNode($this);
}

return $this;
}

}

0 comments on commit 3291d6e

Please sign in to comment.