-{if $__wcf->getBreadcrumbs()->get()|count}
+{if $__wcf->getBreadcrumbs()|count}
<nav class="breadcrumbs">
<ul>
- {foreach from=$__wcf->getBreadcrumbs()->get() item=$breadcrumb}
+ {foreach from=$__wcf->getBreadcrumbs() item=$breadcrumb}
<li title="{$breadcrumb->getLabel()}" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">
{if $breadcrumb->getURL()}<a href="{$breadcrumb->getURL()}" itemprop="url">{/if}<span itemprop="title">{$breadcrumb->getLabel()}</span>{if $breadcrumb->getURL()}</a>{/if} <span><span>»</span></span>
</li>
{/foreach}
</ul>
</nav>
-{/if}
\ No newline at end of file
+{/if}
* @subpackage system.breadcrumb
* @category Community Framework
*/
-class Breadcrumbs extends SingletonFactory {
+class Breadcrumbs extends SingletonFactory implements \Countable, \Iterator {
/**
* list of breadcrumbs
* @var array<wcf\system\breadcrumb\Breadcrumb>
*/
protected $items = array();
+ /**
+ * Current iterator-index
+ */
+ protected $index = 0;
+
/**
* Adds a breadcrumb (insertion order is crucial!).
*
return false;
}
+
+ /**
+ * @see \Countable::count()
+ */
+ public function count() {
+ return count($this->items);
+ }
+
+ /**
+ * @see \Iterator::current()
+ */
+ public function current() {
+ return $this->items[$this->index];
+ }
+
+ /**
+ * @see \Iterator::key()
+ */
+ public function key() {
+ return $this->index;
+ }
+
+ /**
+ * @see \Iterator::valid()
+ */
+ public function valid() {
+ return isset($this->items[$this->index]);
+ }
+
+ /**
+ * @see \Iterator::rewind()
+ */
+ public function rewind() {
+ $this->index = 0;
+ }
+
+ /**
+ * @see \Iterator::next()
+ */
+ public function next() {
+ $this->index++;
+ }
}