1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-20 05:21:29 +02:00

Initial commit to new repo (carried over from: https://github.com/ryancramerdesign/ProcessWire/tree/devns)

This commit is contained in:
Ryan Cramer
2016-09-02 14:55:17 -04:00
parent cfae5fc6f3
commit bac5b0de5d
1691 changed files with 279091 additions and 1 deletions

46
wire/core/Breadcrumbs.php Normal file
View File

@@ -0,0 +1,46 @@
<?php namespace ProcessWire;
/**
* ProcessWire Breadcrumbs
*
* Provides basic breadcrumb capability
*
* This file is licensed under the MIT license.
* https://processwire.com/about/license/mit/
*
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
* https://processwire.com
*
*
*/
/**
* class Breadcrumbs
*
* Holds multiple Breadcrumb items
*
*/
class Breadcrumbs extends WireArray {
public function isValidItem($item) {
return $item instanceof Breadcrumb;
}
public function add($item) {
if($item instanceof Page) {
$page = $item;
$item = $this->wire(new Breadcrumb());
$item->title = $page->get("title|name");
$item->url = $page->url;
} else if($item instanceof Breadcrumb) {
$this->wire($item);
}
return parent::add($item);
}
}