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 
9 class Breadcrumbs implements B\Breadcrumbs
10 {
11  use ComponentHelper;
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 }
Class Factory.
Class BaseForm.
checkArgInstanceOf($which, $value, $class)
Throw an InvalidArgumentException if $value is not an instance of $class.
trait ComponentHelper
Provides common functionality for component implementations.
checkArgListElements($which, array &$values, &$classes)
Check every element of the list if it is an instance of one of the given classes. ...