ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Breadcrumbs.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2017 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
5
8
9class Breadcrumbs implements B\Breadcrumbs
10{
12
16 protected $crumbs;
17
18 public function __construct(array $crumbs)
19 {
20 $types = array(\ILIAS\UI\Component\Link\Standard::class);
21 $this->checkArgListElements("crumbs", $crumbs, $types);
22 $this->crumbs = $crumbs;
23 }
24
25
29 public function getItems()
30 {
31 return $this->crumbs;
32 }
33
37 public function withAppendedItem($crumb)
38 {
39 $this->checkArgInstanceOf("crumb", $crumb, \ILIAS\UI\Component\Link\Standard::class);
40 $clone = clone $this;
41 $clone->crumbs[] = $crumb;
42 return $clone;
43 }
44}
An exception for terminatinating execution or to throw for unit testing.
getItems()
Get all crumbs.\ILIAS\UI\Component\Link\Standard[]
Definition: Breadcrumbs.php:29
withAppendedItem($crumb)
Append an crumb-entry to the bar.Breadcrumbs
Definition: Breadcrumbs.php:37
A component is the most general form of an entity in the UI.
Definition: Component.php:14
checkArgListElements($which, array &$values, &$classes)
Check every element of the list if it is an instance of one of the given classes.
trait ComponentHelper
Provides common functionality for component implementations.
checkArgInstanceOf($which, $value, $class)
Throw an InvalidArgumentException if $value is not an instance of $class.
Class BaseForm.
Class Factory.