Skip to content

Commit

Permalink
Update Breadcrumb.php
Browse files Browse the repository at this point in the history
  • Loading branch information
viames committed Aug 23, 2019
1 parent a021c0c commit 24f7792
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,30 @@ public static function getInstance() {
*
* @param string Title of the sub-path.
* @param string Destination URL (default NULL).
*/
public static function path(string $title, string $url=NULL) {

$self = self::getInstance();

$path = new \stdClass();
$path->title = $title;
$path->url = $url;
$path->active = TRUE;

// just last active path will remains active
foreach ($self->paths as $p) {
$p->active = FALSE;
}

$self->paths[] = $path;

}

/**
* Adds a new sub-path to Breadcrumb. Chainable method.
*
* @param string Title of the sub-path.
* @param string Destination URL (default NULL).
* @return Breadcrumb
*/
public function addPath($title, $url=NULL) {
Expand Down

0 comments on commit 24f7792

Please sign in to comment.